Esempio n. 1
0
StackDlg::StackDlg(QWidget *parent) : QDialog(parent) {
  QssStyle::setStyle(":/myqss.qss");
  this->setWindowTitle(tr("Stacked Widget"));

  list = new QListWidget(this);
  list->insertItem(0, tr("Window1"));
  list->insertItem(1, tr("Window2"));
  list->insertItem(2, tr("Window3"));

  label1 = new QLabel(tr("Window Test1"));
  label2 = new QLabel(tr("Window Test2"));
  label3 = new QLabel(tr("Window Test3"));

  stack = new QStackedWidget(this);
  stack->addWidget(label1);
  stack->addWidget(label2);
  stack->addWidget(label3);

  QHBoxLayout *mainLayout = new QHBoxLayout(this);
  mainLayout->setMargin(5);
  mainLayout->setSpacing(5);
  mainLayout->addWidget(list);
  mainLayout->addWidget(stack, 0, Qt::AlignHCenter);
  mainLayout->setStretchFactor(list, 1);
  mainLayout->setStretchFactor(stack, 3);
  connect(list, SIGNAL(currentRowChanged(int)), stack,
          SLOT(setCurrentIndex(int)));

  int width = sizeHint().width();
  int height = sizeHint().height();
  resize(2 * width, 2 * height);
}
Dialog::Dialog( QWidget *parent ) : QDialog( parent )
{
	//ui.setupUi( this );
	QLabel *Label1 = new QLabel( tr( "Label1" ) );
	QLabel *Label2 = new QLabel( tr( "Label2" ) );
	QLabel *Label3 = new QLabel( tr( "Label3" ) );

	QListWidget *list = new QListWidget( this );
	list->insertItem( 0, tr( "Window1" ) );
	list->insertItem( 1, tr( "Window2" ) );
	list->insertItem( 2, tr( "Window3" ) );

	QStackedWidget *stack = new QStackedWidget( this );
	stack->addWidget( Label1 );
	stack->addWidget( Label2 );
	stack->addWidget( Label3 );

	QHBoxLayout *Layout = new QHBoxLayout( this );
	Layout->setMargin( 5 );
	Layout->setSpacing( 5 );
	Layout->addWidget( list );
	Layout->addWidget( stack, 0, Qt::AlignHCenter );
	Layout->setStretchFactor( list, 1 );
	Layout->setStretchFactor( stack, 3 );
	connect( list, SIGNAL( currentRowChanged( int ) ), stack, SLOT( setCurrentIndex( int ) ) );
}
Esempio n. 3
0
    void setupUI() {
        p->setObjectName(QStringLiteral("FieldLineEdit"));

        hLayout = new QHBoxLayout(p);
        hLayout->setMargin(0);
        hLayout->setSpacing(2);

        m_pushButtonType = new QPushButton(p);
        appendWidget(m_pushButtonType);
        hLayout->setStretchFactor(m_pushButtonType, 0);
        m_pushButtonType->setObjectName(QStringLiteral("FieldLineEditButton"));

        if (isMultiLine) {
            m_multiLineEditText = new KTextEdit(p);
            appendWidget(m_multiLineEditText);
            connect(m_multiLineEditText, &KTextEdit::textChanged, p, &MenuLineEdit::slotTextChanged);
            m_multiLineEditText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
            p->setFocusProxy(m_multiLineEditText);
            m_multiLineEditText->setAcceptRichText(false);
        } else {
            m_singleLineEditText = new KLineEdit(p);
            appendWidget(m_singleLineEditText);
            hLayout->setStretchFactor(m_singleLineEditText, 100);
            m_singleLineEditText->setClearButtonEnabled(true);
            m_singleLineEditText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
            m_singleLineEditText->setCompletionMode(KCompletion::CompletionPopup);
            m_singleLineEditText->completionObject()->setIgnoreCase(true);
            p->setFocusProxy(m_singleLineEditText);
            connect(m_singleLineEditText, &KLineEdit::textEdited, p, &MenuLineEdit::textChanged);
        }

        p->setFocusPolicy(Qt::StrongFocus); // FIXME improve focus handling
        p->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    }
Esempio n. 4
0
int main( int argc, char **argv )
{
	QApplication a( argc, argv );

	QWidget window;
	window.resize(320, 240);

	QHBoxLayout *hlayout = new QHBoxLayout;
	QLabel *label1 = new QLabel(QObject::tr("Name1"));
	label1->setFrameShape(QFrame::StyledPanel);
	QLabel *label2 = new QLabel(QObject::tr("Name2"));
	label2->setFrameShape(QFrame::StyledPanel);
	QLabel *label3 = new QLabel(QObject::tr("Name3"));
	label3->setFrameShape(QFrame::StyledPanel);

	//设置控件按照比例的大小。但是不会比最小者小了。
	//根据自己的理解,这里的数字表示控件占有的总控件的比例,这里总空间就是1+2+3.
	//如果设置的是0的话应该使用的是空间的最小大小,因为无法再小了。
	//所以如其中一个是0那么其他的factor应把除了这个最小的空间之外所有的空间占据并分配。
	hlayout->addWidget(label1);
	hlayout->setStretchFactor(label1,1);
	hlayout->addWidget(label2);
	hlayout->setStretchFactor(label2,2);
	//hlayout->addStretch(0);//添加了一个空白
	hlayout->addWidget(label3);
	hlayout->setStretchFactor(label3,3);


	window.show();
	window.setLayout(hlayout);//这里设置选用哪个布局

	return a.exec();
}
Esempio n. 5
0
StackDlg::StackDlg(QWidget *parent, Qt::WindowFlags f1)
        : QDialog(parent,f1)
{
    setWindowTitle(tr("Stacked Widgets"));
    
    list = new QListWidget(this);
    list->insertItem(0,tr("Window 1"));
    list->insertItem(1,tr("Window 2"));
    list->insertItem(2,tr("Window 3"));
     
    label1 = new QLabel(tr("This is Window 1 !"));
    label2 = new QLabel(tr("This is Window 2 !"));
    label3 = new QLabel(tr("This is Window 3 !"));
       
    stack = new QStackedWidget(this);
    stack->addWidget(label1);
    stack->addWidget(label2);
    stack->addWidget(label3);
     
    QHBoxLayout *mainLayout = new QHBoxLayout(this);
    mainLayout->setMargin(5);
    mainLayout->setSpacing(5);
    mainLayout->addWidget(list);
    mainLayout->addWidget(stack,0,Qt::AlignHCenter);
    mainLayout->setStretchFactor(list,1);
    mainLayout->setStretchFactor(stack,3);
    
    connect(list,SIGNAL(currentRowChanged(int)),stack,SLOT(setCurrentIndex(int)));
    
}
Esempio n. 6
0
stackedDlg::stackedDlg(QWidget *parent)
	: QWidget(parent)
{
	leftlist = new QListWidget;
	leftlist->insertItem(0,tr("欢迎"));
	leftlist->insertItem(1,tr("分组管理"));
	leftlist->insertItem(2,tr("文档管理"));
	leftlist->insertItem(3,tr("指标管理"));
	leftlist->insertItem(4,tr("评分管理"));
	leftlist->insertItem(5,tr("互评管理"));
	leftlist->insertItem(6,tr("贡献管理"));
	leftlist->insertItem(7,tr("成绩管理"));

	groupmng = new GroupMng;
	welcome = new Welcome;

	stack = new QStackedWidget;
	stack->addWidget(welcome);
	stack->addWidget(groupmng);

	QHBoxLayout *mainLayout = new QHBoxLayout;
	mainLayout->setMargin(5);
	mainLayout->setSpacing(5);
	mainLayout->addWidget(leftlist);
	mainLayout->addWidget(stack,0,Qt::AlignHCenter);
	mainLayout->setStretchFactor(leftlist,1);
	mainLayout->setStretchFactor(stack,7);
	connect(leftlist,SIGNAL(currentRowChanged(int)),stack,SLOT(setCurrentIndex(int)));

	setLayout(mainLayout);
}
YACReaderSpinSliderWidget::YACReaderSpinSliderWidget(QWidget * parent,bool strechableSlider)
	:QWidget(parent),tracking(true)
{
	QHBoxLayout * layout = new QHBoxLayout;
	layout->addWidget(label = new QLabel(this),1);
	if(!strechableSlider)
	  layout->addStretch();
	spinBox = new QSpinBox(this);
	layout->addWidget(spinBox);
	slider = new QSlider(Qt::Horizontal,this);
	layout->addWidget(slider);
	if(strechableSlider)
	{
		layout->setStretchFactor(slider,0.85);
		layout->setStretchFactor(spinBox,0);
		layout->setStretchFactor(label,0.15);
	}

	connect(spinBox, SIGNAL(valueChanged(int)), slider,  SLOT(setValue(int)));
	connect(slider,  SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));

	connect(slider, SIGNAL(valueChanged(int)), this, SLOT(valueWillChange(int)));
	connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(valueWillChangeFromSpinBox(int)));

	connect(slider, SIGNAL(sliderReleased()), this, SLOT(sliderRelease()));

	setLayout(layout);
}
Esempio n. 8
0
PaletteEditor::PaletteEditor( Project& proj, QWidget* parent ) :
    QDialog( parent ),
    m_Proj( proj),
    m_Selected( 1 )
{
    m_RGBWidget = new RGBWidget();
    m_PaletteWidget = new PaletteWidget(proj.PaletteConst());
    m_PaletteWidget->EnableRangePicking( true );
    resize( QSize(500,400) );

    QHBoxLayout* h = new QHBoxLayout();
        QVBoxLayout* v = new QVBoxLayout();
        v->addWidget( m_RGBWidget );
        m_SpreadButton = new QPushButton("Spread");
        v->addWidget( m_SpreadButton );
//        v->addStretch();
    h->addLayout( v );
    h->setStretchFactor(v,0);
    h->addWidget( m_PaletteWidget );
    h->setStretchFactor(m_PaletteWidget,1);
    setLayout( h );

    {
        RGBx c( m_Proj.GetColour( m_Selected ) );
        m_RGBWidget->setColour( QColor( c.r, c.g, c.b ) );
    }
    connect( m_RGBWidget, SIGNAL( colourChanged() ), this, SLOT( colourChanged() ) );
    connect( m_PaletteWidget, SIGNAL( rangeAltered() ), this, SLOT( paletteRangeAltered() ) );
    connect( m_PaletteWidget, SIGNAL( pickedLeftButton(int) ), this, SLOT( colourPicked(int) ) );
    connect( m_SpreadButton, SIGNAL( clicked() ), this, SLOT( spreadColours() ) );

    m_SpreadButton->setEnabled( m_PaletteWidget->RangeValid() );

    m_Proj.AddListener( this );
}
Esempio n. 9
0
DisplayDialog::DisplayDialog(QWidget *parent)
                     : QDialog(parent)
{
  vLayout = new QVBoxLayout(this);
  setAttribute( Qt::WA_DeleteOnClose  );
  Text = new QTextEdit(this);
  //Text->setTextFormat(Qt::PlainText);
  Text->setReadOnly(true);
  Text->setMinimumSize(200, 100);
  vLayout->addWidget(Text);

  QHBoxLayout *h = new QHBoxLayout(this);
  vLayout->addLayout(h);

	QWidget *w1 = new QWidget(this);
	h->addWidget( w1 );
  h->setStretchFactor(w1,5); // stretchable placeholder

  QPushButton *ButtonClose = new QPushButton(tr("Close"), this);
	h->addWidget( ButtonClose );
  connect(ButtonClose, SIGNAL(clicked()), SLOT(slotClose()));
  ButtonClose->setFocus();

	QWidget *w2= new QWidget(this);
	h->addWidget( w2 );
  h->setStretchFactor(w2,5); // stretchable placeholder
}
void HospitalInternalPaymentForm::setMyLayout()
{
    QGridLayout *leftTopLayout = new QGridLayout;
    leftTopLayout->addWidget(m_particulars,0,0);
    leftTopLayout->addWidget(m_summarizing,0,1);
    leftTopLayout->addWidget(m_startDateLabel,1,0);
    leftTopLayout->addWidget(m_startDateEdit,1,1);
    leftTopLayout->addWidget(m_endDateLabel,2,0);
    leftTopLayout->addWidget(m_endDateEdit,2,1);
    leftTopLayout->addWidget(m_allDueIncomeLabel,3,0);
    leftTopLayout->addWidget(m_allDueIncomeEdit,3,1);

    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addLayout(leftTopLayout);
    leftLayout->addStretch();

    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout->addWidget(m_resultView);

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addLayout(leftLayout);
    mainLayout->addLayout(rightLayout);
    mainLayout->setStretchFactor(rightLayout,1);

    setLayout(mainLayout);
}
Esempio n. 11
0
void ClinicChargeStatisticForm::setMyLayout()
{
    QHBoxLayout *mainLayout = new QHBoxLayout;
    QVBoxLayout *leftLayout = new QVBoxLayout;
    QVBoxLayout *rightLayout = new QVBoxLayout;
    QGridLayout *leftTopLayout = new QGridLayout;

    leftTopLayout->addWidget(m_nameLabel,0,0);
    leftTopLayout->addWidget(m_nameEdit,0,1);
    leftTopLayout->addWidget(m_genderLabel,1,0);
    leftTopLayout->addWidget(m_genderComboBox,1,1);
    leftTopLayout->addWidget(m_startDateLabel,2,0);
    leftTopLayout->addWidget(m_startDateEdit,2,1);
    leftTopLayout->addWidget(m_endDateLabel,3,0);
    leftTopLayout->addWidget(m_endDateEdit,3,1);

    leftLayout->addLayout(leftTopLayout);
    leftLayout->addStretch();

    rightLayout->addWidget(m_resultsView);

    mainLayout->addLayout(leftLayout);
    mainLayout->addLayout(rightLayout);
    mainLayout->setStretchFactor(rightLayout, 1);

    setLayout(mainLayout);
}
Esempio n. 12
0
iqrfe::ClsStringWidget::ClsStringWidget(ClsStringParameter &_parameter, 
					QWidget *_pqwgtParent, 
					const char *_pcName) 
    : ClsParameterWidget(_parameter,
			 false,
			 _pqwgtParent, 
			 _pcName) {
    // Widget initialized directly from parent parameter.  It is
    // assumed that the data in the parent is valid.

    QHBoxLayout *pqlayLayout = new QHBoxLayout(this);
    
    QLabel *pqlabWidgetLabel = new QLabel(this);
    pqlabWidgetLabel->setText(string2QString(_parameter.getLabel()));
    pqlayLayout->addWidget(pqlabWidgetLabel);
//    pqlayLayout->setAlignment(pqlabWidgetLabel, Qt::AlignHCenter ); 

    pqledValueWidget = new QLineEdit(string2QString(_parameter.getValue()), this);
    connect(pqledValueWidget, SIGNAL(textChanged(const QString &)), this, SLOT(setValueChanged()));
    pqlayLayout->addWidget(pqledValueWidget);
    pqlayLayout->setStretchFactor ( pqledValueWidget, 2 );
    setToolTip(_parameter.getDescription().c_str());

    setFixedHeight(sizeHint().height());
}
Esempio n. 13
0
IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
    m_layout = new QVBoxLayout(this);
    QHBoxLayout *descLayout = new QHBoxLayout(m_layout);
    descLayout->setMargin(5);
    m_description = new QLabel(tr("Missing description"), this);
    QWhatsThis::add(m_description, tr("Description of the tab's content"));
    descLayout->addWidget(m_description);
    descLayout->setStretchFactor(m_description, 5);
    QPushButton *close = new QPushButton( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
                                          QString::null, this);
    close->setFixedSize( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
    QWhatsThis::add(close, tr("Close this tab"));
    connect(close, SIGNAL(clicked()), this, SLOT(remove()));
    descLayout->addWidget(close);
    descLayout->setStretchFactor(m_description, 1);
}
Esempio n. 14
0
PanelChecklist::PanelChecklist(QSize sz, QWidget *pParent)
 : AbstractPanel(sz, pParent)
{
	setFixedSize(sz);

	GraphicsSingleton* pG = GraphicsSingleton::GetInstance();
	const QFont& font = pG->GetFont(GraphicsSingleton::fDialog);

	// Main layout
	QHBoxLayout* pMainLayout = new QHBoxLayout;
	setLayout(pMainLayout);

	// Check list (left column) layout
	QVBoxLayout* pCheckLayout = new QVBoxLayout;
// 	pCheckLayout->addWidget(new QLabel(tr("Checklist")));
	m_plwCheck = new NesisListWidget();
	m_plwCheck->setMaximumWidth(180);
	m_plwCheck->setFont(font);
	pCheckLayout->addWidget(m_plwCheck);
	pMainLayout->addLayout(pCheckLayout);

	QVBoxLayout* pContentLayout = new QVBoxLayout;
// 	pContentLayout->addWidget(new QLabel(tr("Content")));
	m_pwContent = new WidgetChecklist(this);
	pContentLayout->addWidget(m_pwContent);
	pContentLayout->setStretchFactor(m_pwContent, 100);
	pMainLayout->addLayout(pContentLayout);

	// Tune the layout.
	pMainLayout->setStretchFactor(pContentLayout, 100);

	// Load data from the file.
	Settings* pSettings = Settings::GetInstance();
	QFile file(pSettings->GetCheckListPath() + QString("DefaultCheck.xml"));
	QXmlInputSource inputSource(&file);
	QXmlSimpleReader reader;
	reader.setContentHandler(this);
	reader.setErrorHandler(this);
	m_pCheckItem   = NULL;
	reader.parse(inputSource);

	// Connections
	connect(
		m_plwCheck->selectionModel(),
		SIGNAL(currentRowChanged(const QModelIndex&, const QModelIndex&)),
		this, SLOT(OnCurrentRowChanged(const QModelIndex&, const QModelIndex&))
	);
	
	// Connect main widget with direct buttons
	connect(m_plwCheck, SIGNAL(NesisButton(int)), 
			  GetWidgetMain(), SLOT(ActivatePanel(int)));

	// Set initial selection
	m_plwCheck->setCurrentRow(0);
	
// 	qDebug() << "CL:C:Finish";
}
Esempio n. 15
0
void QwtCounter::initCounter()
{
    d_data = new PrivateData;

    QHBoxLayout *layout = new QHBoxLayout( this );
    layout->setSpacing( 0 );
    layout->setMargin( 0 );

    for ( int i = ButtonCnt - 1; i >= 0; i-- )
    {
        QwtArrowButton *btn =
            new QwtArrowButton( i + 1, Qt::DownArrow, this );
        btn->setFocusPolicy( Qt::NoFocus );
        btn->installEventFilter( this );
        layout->addWidget( btn );

        connect( btn, SIGNAL( released() ), SLOT( btnReleased() ) );
        connect( btn, SIGNAL( clicked() ), SLOT( btnClicked() ) );

        d_data->buttonDown[i] = btn;
    }

    d_data->valueEdit = new QLineEdit( this );
    d_data->valueEdit->setReadOnly( false );
    d_data->valueEdit->setValidator( new QDoubleValidator( d_data->valueEdit ) );
    layout->addWidget( d_data->valueEdit );

    connect( d_data->valueEdit, SIGNAL( editingFinished() ),
         SLOT( textChanged() ) );

    layout->setStretchFactor( d_data->valueEdit, 10 );

    for ( int i = 0; i < ButtonCnt; i++ )
    {
        QwtArrowButton *btn =
            new QwtArrowButton( i + 1, Qt::UpArrow, this );
        btn->setFocusPolicy( Qt::NoFocus );
        btn->installEventFilter( this );
        layout->addWidget( btn );

        connect( btn, SIGNAL( released() ), SLOT( btnReleased() ) );
        connect( btn, SIGNAL( clicked() ), SLOT( btnClicked() ) );

        d_data->buttonUp[i] = btn;
    }

    setNumButtons( 2 );
    setRange( 0.0, 1.0 );
    setSingleStep( 0.001 );
    setValue( 0.0 );

    setSizePolicy(
        QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );

    setFocusProxy( d_data->valueEdit );
    setFocusPolicy( Qt::StrongFocus );
}
Esempio n. 16
0
// -------------------------------------------------------------------------------------------------
AboutDialog::AboutDialog(QWidget* parent, const char* name)
    throw ()
    : QDialog(parent, name)
{
     m_mainLayout = new QVBoxLayout(this, 10, 6);
    setCaption(tr("About The Fabulous Logic Analyzer"));
    
    // the top of the dialog
    QHBox* titleBox = new QHBox(this);
    QLabel* titleIcon = new QLabel(titleBox);
    titleIcon->setPixmap(QPixmap::fromMimeSource("tfla-01_32.png"));
    QLabel* titleText = new QLabel(tr("<p><b>The Fabulous Logic Analyzer "VERSION_STRING"</b></p>"),
            titleBox);
    titleBox->setStretchFactor(titleIcon, 0);
    titleBox->setStretchFactor(titleText, 5);
    titleBox->setSpacing(5);
    
    // the tab
    m_tabWidget = new QTabWidget(this);
    setupAboutTab();
    setupLicenseTab();
    
    // the ok Button
    QPushButton* okButton = new QPushButton(tr("&Close"), this, "Close button");
    okButton->setDefault(true);
    QWidget* filler = new QWidget(this);
    QHBoxLayout* buttonLayout = new QHBoxLayout(0, 0, 6);
    buttonLayout->addWidget(filler);
    buttonLayout->addWidget(okButton);
    buttonLayout->setStretchFactor(filler, 1);
    buttonLayout->setStretchFactor(okButton, 0);
    
    // main layout
    m_mainLayout->addWidget(titleBox);
    m_mainLayout->addWidget(m_tabWidget);
    m_mainLayout->addStretch(5);
    m_mainLayout->addLayout(buttonLayout);
    
    connect(okButton, SIGNAL(clicked()), SLOT(accept()));
}
Esempio n. 17
0
ConfigDialog::ConfigDialog()
{
	m_contentsWidget = new QListWidget;
	m_contentsWidget->setMovement(QListView::Static);

	m_pagesWidget = new QStackedWidget;

	m_configPages.push_back(new InterfacePage);
	//m_configPages.push_back(new LetterboxPage);

	for (QList<ConfigPage *>::iterator it = m_configPages.begin(); it != m_configPages.end(); ++it)
	{
		m_pagesWidget->addWidget(*it);
		(*it)->readConfig();

		QListWidgetItem *button = new QListWidgetItem((*it)->pageTitle(), m_contentsWidget);
		button->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
	}

	connect(m_contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));

	QPushButton *applyButton = new QPushButton(tr("&Apply"));
	QPushButton *okButton = new QPushButton(tr("&OK"));
	QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
	connect(okButton, SIGNAL(clicked()), this, SLOT(submit()));
	connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));

	m_contentsWidget->setCurrentRow(0);

	QHBoxLayout *horizontalLayout = new QHBoxLayout;
	horizontalLayout->addWidget(m_contentsWidget);
	horizontalLayout->addWidget(m_pagesWidget, 1);
	horizontalLayout->setStretchFactor(m_pagesWidget, 2);

	QHBoxLayout *buttonsLayout = new QHBoxLayout;
	buttonsLayout->addStretch(1);
	buttonsLayout->addWidget(okButton);
	buttonsLayout->addWidget(applyButton);
	buttonsLayout->addWidget(cancelButton);

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addLayout(horizontalLayout);
	mainLayout->addStretch(1);
	mainLayout->addSpacing(12);
	mainLayout->addLayout(buttonsLayout);
	setLayout(mainLayout);

	setWindowTitle(tr("Configure - Quackle"));
}
Esempio n. 18
0
SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent) :
    QWidget(parent)
{
    QHBoxLayout* hbLayout = new QHBoxLayout(this);
    hbLayout->setSpacing(1);
    hbLayout->setMargin(1);

    QLabel* lbl = new QLabel(this);
    lbl->setPixmap(QPixmap::fromImage(getAmmoImage(iconNum)));
    lbl->setMaximumWidth(30);
    lbl->setGeometry(0, 0, 30, 30);
    hbLayout->addWidget(lbl);

    item = new WeaponItem(image, imagegrey, this);
    item->setItemsNum(wNum);
    item->setInfinityState(allowInfinite);
    hbLayout->addWidget(item);

    hbLayout->setStretchFactor(lbl, 1);
    hbLayout->setStretchFactor(item, 99);
    hbLayout->setAlignment(lbl, Qt::AlignLeft | Qt::AlignVCenter);
    hbLayout->setAlignment(item, Qt::AlignLeft | Qt::AlignVCenter);
}
Esempio n. 19
0
PluginDialog::PluginDialog()
{
	#ifdef Q_WS_WIN
		os = "windows";
	#endif
	#ifdef Q_WS_X11
		os = "X11";
	#endif

	setWindowIcon(QIcon(":/plug.png"));

	listWidget = new QTreeWidget(this);
	listWidget->setIconSize(QSize(24, 24));
	listWidget->header()->hide();

	info = new QPushButton(tr("plus d'info"));
	installButton = new QPushButton(tr("Installer"));
	line = new QLineEdit;

	line->setPlaceholderText(tr("Rechercher"));

	connect(info, SIGNAL(clicked()), this, SLOT(getInfo()));
	connect(installButton, SIGNAL(clicked()), this, SLOT(installPlugin()));
	connect(listWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(indexChanged()));
	connect(line, SIGNAL(textChanged(QString)), this, SLOT(search()));

	QVBoxLayout *lay = new QVBoxLayout;
	QHBoxLayout *hLay = new QHBoxLayout;
	lay->addWidget(listWidget);
	hLay->addStretch();
	hLay->addWidget(info);
	hLay->addWidget(line);
	hLay->addWidget(installButton);
	lay->addLayout(hLay);

	hLay->setStretchFactor(line, 100);

	setLayout(lay);

	QSettings set(qApp->applicationDirPath() + "/pluginsList.ini", QSettings::IniFormat);
	set.beginGroup(os);
	QStringList items = set.value("list").toStringList();
	set.endGroup();
	fillTree(items);

	indexChanged();
	resize(500, 400);
}
Esempio n. 20
0
QWidget * KPassivePopup::standardView( const QString& caption,
                                     const QString& text,
                                     const QPixmap& icon,
                                     QWidget *parent )
{
    QWidget *top = new QWidget(parent ? parent : this);
    QVBoxLayout *vb = new QVBoxLayout(top);
    vb->setMargin(0);
    top->setLayout(vb);

    QHBoxLayout *hb = 0;
    if ( !icon.isNull() ) {
	hb = new QHBoxLayout( top );
	hb->setMargin( 0 );
        vb->addLayout( hb );
	d->ttlIcon = new QLabel( top );
	d->ttlIcon->setPixmap( icon );
        d->ttlIcon->setAlignment( Qt::AlignLeft );
        hb->addWidget( d->ttlIcon );
    }

    if ( !caption.isEmpty() ) {
	d->ttl = new QLabel( caption, top );
	QFont fnt = d->ttl->font();
	fnt.setBold( true );
	d->ttl->setFont( fnt );
	d->ttl->setAlignment( Qt::AlignHCenter );

        if ( hb ) {
            hb->addWidget(d->ttl);
            hb->setStretchFactor( d->ttl, 10 ); // enforce centering
        } else {
            vb->addWidget(d->ttl);
        }
    }

    if ( !text.isEmpty() ) {
        d->msg = new QLabel( text, top );
        d->msg->setAlignment( Qt::AlignLeft );
        d->msg->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
        d->msg->setOpenExternalLinks(true);
        vb->addWidget(d->msg);
    }

    return top;
}
Esempio n. 21
0
noteWidget::noteWidget(QWidget *parent) : QWidget(parent)
{
    ew = new editWidget(this);
    nt = new noteTree(this);



    QHBoxLayout * layout = new QHBoxLayout();
    layout->addWidget(nt);
    layout->addWidget(ew);

    layout->setStretchFactor(nt, 2);
    layout->setStretchFactor(ew, 5);

    this->setLayout(layout);

    //双击笔记时打开笔记
    connect(nt, SIGNAL(doubleclicked(QString)), ew, SLOT(slotLoadText(QString)));
}
/**
 * Constructor.
 * @param property :: A property to edit.
 * @param parent :: A widget parent for the editor widget.
 */
DoubleDialogEditor::DoubleDialogEditor(QtProperty *property, QWidget *parent):QWidget(parent),m_property(property)
{
  QHBoxLayout *layout = new QHBoxLayout;
  m_editor = new DoubleEditor(property, this);
  layout->addWidget(m_editor);
  setFocusProxy(m_editor);
  setFocusPolicy(Qt::StrongFocus);

  m_button = new QPushButton("...",this);
  m_button->setMaximumSize(20,1000000);
  connect(m_button,SIGNAL(clicked()),this,SLOT(runDialog()));
  layout->addWidget(m_button);
  layout->setContentsMargins(0,0,0,0);
  layout->setSpacing(0);
  layout->setStretchFactor(m_button,0);
  this->setLayout(layout);

  m_editor->installEventFilter(this);
  m_button->installEventFilter(this);
}
void ClinicCharge::SetMyLayout()
{
    QVBoxLayout *LeftLayout = new QVBoxLayout;
    LeftLayout->addWidget(chargeNumGroup);
    LeftLayout->addWidget(patientGroup);
    LeftLayout->addWidget(insuranceGroup);
    LeftLayout->addWidget(doctorGroup);
    LeftLayout->addWidget(incomeGroup);
    LeftLayout->addStretch();

    QVBoxLayout *RightLayout = new QVBoxLayout;
    RightLayout->addWidget(chargeTableView);

    QHBoxLayout *MainLayout = new QHBoxLayout;
    MainLayout->addLayout(LeftLayout);
    MainLayout->addLayout(RightLayout);
    MainLayout->setStretchFactor(RightLayout,1);

    setLayout(MainLayout);
}
Esempio n. 24
0
TopGroupConf::TopGroupConf(QWidget *parent, const char *name):QWidget(parent,name)
{
    QHBoxLayout *layout = new QHBoxLayout(this);

    QPushButton *power = new QPushButton("Power",this,"power");
    layout->addWidget(power);
    connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
//	power->setGeometry(5, 5,40, 20);

    layout->addSpacing(5);

    QPushButton *source = new QPushButton("Source",this,"source");
    layout->addWidget(source);
    connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
    //	source->setGeometry(50,5,40,20);

    remotes = new QComboBox(true, this, "remotes");
    layout->addWidget(remotes);
    layout->setStretchFactor(remotes, 1);
    connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) );


    QPushButton *newrem = new QPushButton("New", this, "new");
    layout->addWidget(newrem);
    connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) );


    /*	remotes = new QComboBox(false, this, "remotes");
    	connect(remotes, SIGNAL(activated(const QString&)), this->parentWidget(), SLOT(remoteSelected(const QString&)) );
    	remotes->insertItem("Select Remote");
    //	remotes->setGeometry(135,5,95,20);

    	QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel");
    //	remoteLabel->setGeometry(90,5,40,20);
    	remoteLabel->setAlignment(AlignRight | AlignVCenter);

    	layout->addWidget(remoteLabel);
    	layout->addWidget(remotes);
    */
}
void GsTL_slider::init( const QString& title ) {

  QHBoxLayout *h = new QHBoxLayout();
  this->setLayout(h);
  h->setSpacing(4);
  
  label_ = new QLabel( title, this);
  
  slider_ = new QSlider( Qt::Horizontal, this);
  slider_->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );

  
  lineedit_ = new QLineEdit( this);
  lineedit_->setMaximumWidth( 60 );
  lineedit_->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );

  reset_button_ = new QPushButton( "Reset", this );
  reset_button_->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
  reset_button_->setMaximumWidth( 60 );

  

  h->addWidget(label_);
  h->addWidget(slider_);
  h->addWidget(lineedit_);
  h->addWidget(reset_button_);
  h->setStretchFactor( slider_, 2 );
  
  QObject::connect( lineedit_, SIGNAL( returnPressed() ),
		    this, SLOT( updateSliderValue() ) );
  QObject::connect( slider_, SIGNAL( valueChanged( int ) ),
		    this, SLOT( updateLineedit( int ) ) );
  QObject::connect( reset_button_, SIGNAL( clicked() ),
		    this, SLOT( reset() ) );
 
  slider_->setMinimum( 0 );
  slider_->setMaximum( slider_max_ );

  slider_->setPageStep( slider_step_ );
}
StringDialogEditor::StringDialogEditor(QtProperty *property, QWidget *parent):QWidget(parent),m_property(property)
{
  QHBoxLayout *layout = new QHBoxLayout;
  m_lineEdit = new QLineEdit(this);
  layout->addWidget(m_lineEdit);
  setFocusProxy(m_lineEdit);
  connect(m_lineEdit,SIGNAL(editingFinished()),this,SLOT(updateProperty()));
  QtStringPropertyManager* mgr = dynamic_cast<QtStringPropertyManager*>(property->propertyManager());
  if (mgr)
  {
    m_lineEdit->setText(mgr->value(property));
  }

  QPushButton* button = new QPushButton("...",this);
  button->setMaximumSize(20,1000000);
  connect(button,SIGNAL(clicked()),this,SLOT(runDialog()));
  layout->addWidget(button);
  layout->setContentsMargins(0,0,0,0);
  layout->setSpacing(0);
  layout->setStretchFactor(button,0);
  this->setLayout(layout);
}
Esempio n. 27
0
ToolTip::ToolTip(QWidget *parent)
    : QWidget(parent),
      d(new ToolTipPrivate())
{
    setAttribute(Qt::WA_TranslucentBackground);
    setWindowFlags(Qt::ToolTip);
    d->preview = new WindowPreview(this);
    d->text = new TipTextWidget(this);
    d->imageLabel = new QLabel(this);

    d->imageLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    d->animation = new QPropertyAnimation(this, "pos", this);
    d->animation->setEasingCurve(QEasingCurve::InOutQuad);
    d->animation->setDuration(250);

    d->background = new FrameSvg(this);
    d->background->setImagePath("widgets/tooltip");
    d->background->setEnabledBorders(FrameSvg::AllBorders);
    updateTheme();
    connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(updateTheme()));
    connect(d->preview, SIGNAL(windowPreviewClicked(WId,Qt::MouseButtons,Qt::KeyboardModifiers,QPoint)),
            this, SIGNAL(activateWindowByWId(WId,Qt::MouseButtons,Qt::KeyboardModifiers,QPoint)));

    QHBoxLayout *previewHBoxLayout = new QHBoxLayout;
    previewHBoxLayout->addWidget(d->preview);

    QHBoxLayout *iconTextHBoxLayout = new QHBoxLayout;
    iconTextHBoxLayout->addWidget(d->imageLabel);
    iconTextHBoxLayout->setAlignment(d->imageLabel, Qt::AlignTop | Qt::AlignHCenter);
    iconTextHBoxLayout->addWidget(d->text);
    iconTextHBoxLayout->setAlignment(d->text, Qt::AlignLeft | Qt::AlignVCenter);
    iconTextHBoxLayout->setStretchFactor(d->text, 1);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(previewHBoxLayout);
    mainLayout->addLayout(iconTextHBoxLayout);

    setLayout(mainLayout);
}
Esempio n. 28
0
InfoWidgetMsh::InfoWidgetMsh(Particles *part,QWidget *parent) : QGroupBox("Meshes",parent){

    setCheckable(true);
    setChecked(false);
    setEnabled(false);

    nbMeshes = 0;
    mSpec = NULL;
    activeMeshBx = new QCheckBox();
    meshBx = new QComboBox;
    wireBx = new QCheckBox("Wired mesh");
    wireBt = new QPushButton("Apply to all");
    cullBackFaceBx = new QCheckBox("Cull back face");
    cullBackFaceBt = new QPushButton("Apply to all");

    QObject::connect(activeMeshBx,SIGNAL(clicked(bool)),this,SLOT(changeActiveMesh(bool)));
    QObject::connect(meshBx,SIGNAL(currentIndexChanged(int)),this,SLOT(setMesh(int)));
    QObject::connect(wireBx,SIGNAL(clicked(bool)),this,SLOT(changeShowWires(bool)));
    QObject::connect(wireBt,SIGNAL(pressed()),this,SLOT(changeAllShowWires()));
    QObject::connect(cullBackFaceBx,SIGNAL(clicked(bool)),this,SLOT(changeCullBackFace(bool)));
    QObject::connect(cullBackFaceBt,SIGNAL(pressed()),this,SLOT(changeAllCullBackFace()));

    QVBoxLayout *vLayout = new QVBoxLayout;
    QHBoxLayout *hLayout = new QHBoxLayout;
    hLayout->addWidget(activeMeshBx);
    hLayout->addWidget(meshBx);
    hLayout->setStretchFactor(meshBx,1);
    vLayout->addLayout(hLayout);
    QGridLayout *gLayout = new QGridLayout;
    gLayout->setColumnStretch(0,1);
    gLayout->addWidget(wireBx,0,0);
    gLayout->addWidget(wireBt,0,1);
    gLayout->addWidget(cullBackFaceBx,1,0);
    gLayout->addWidget(cullBackFaceBt,1,1);
    vLayout->addLayout(gLayout);
    setLayout(vLayout);
    loadParticles(part);
}
Esempio n. 29
0
BoardSetupDialog::BoardSetupDialog(QWidget *parent) : QDialog(parent)
{
	resize(700,550);
	setSizeGripEnabled(true);
	
	// construct the board
	BoardSetupFactory factory;
	BRB * brb = new BRB(&factory);
	m_boardFrame = static_cast<BoardSetup *>(brb->getBoardView())->boardFrame();
	initializeBoardName();

	// construct the UI elements
	m_horizontalSymmetry = new QCheckBox(tr("Horizontal"));
	m_verticalSymmetry = new QCheckBox(tr("Vertical"));
	m_diagonalSymmetry = new QCheckBox(tr("Diagonal"));
	m_horizontalSymmetry->setCheckState(Qt::Checked);
	m_verticalSymmetry->setCheckState(Qt::Checked);
	m_diagonalSymmetry->setCheckState(Qt::Checked);

	m_horizontalDimension = constructDimensionComboBox(QUACKLE_BOARD_PARAMETERS->width());
	m_verticalDimension = constructDimensionComboBox(QUACKLE_BOARD_PARAMETERS->height());

	m_boardName = new QLineEdit(QuackleIO::Util::uvStringToQString(QUACKLE_BOARD_PARAMETERS->name()));

	m_saveChanges = new QPushButton(tr("&Save Changes"));
	m_cancel = new QPushButton(tr("&Cancel"));
	m_undoAll = new QPushButton(tr("&Undo All Changes"));
	m_deleteBoard = new QPushButton(tr("&Delete Board"));

	QVBoxLayout * superLayout = new QVBoxLayout;
	Geometry::setupFramedLayout(superLayout);
	QHBoxLayout * mainLayout = new QHBoxLayout;
	Geometry::setupInnerLayout(mainLayout);
	QVBoxLayout * leftSideLayout = new QVBoxLayout;
	Geometry::setupInnerLayout(leftSideLayout);
	QLabel * boardNameLabel = new QLabel(tr("&Board name:"));
	boardNameLabel->setBuddy(m_boardName);
	QGroupBox * dimensionGroup = new QGroupBox(tr("Board dimensions"));
	QHBoxLayout * dimensionRow = new QHBoxLayout(dimensionGroup);
	Geometry::setupFramedLayout(dimensionRow);
	QLabel * dimensionLabel = new QLabel(tr(" by "));
	QGroupBox * symmetryGroup = new QGroupBox(tr("Board symmetry"));
	QVBoxLayout * symmetryCol = new QVBoxLayout(symmetryGroup);
	Geometry::setupFramedLayout(symmetryCol);
	QHBoxLayout * buttonRow = new QHBoxLayout;
	Geometry::setupInnerLayout(buttonRow);

	// build the layout
	dimensionRow->addWidget(m_horizontalDimension);
	dimensionRow->addWidget(dimensionLabel);
	dimensionRow->addWidget(m_verticalDimension);
	dimensionRow->addStretch();

	symmetryCol->addWidget(m_horizontalSymmetry);
	symmetryCol->addWidget(m_verticalSymmetry);
	symmetryCol->addWidget(m_diagonalSymmetry);

	buttonRow->addStretch(1);
	buttonRow->addWidget(m_cancel);
	buttonRow->addWidget(m_saveChanges);

	leftSideLayout->addWidget(boardNameLabel);
	leftSideLayout->addWidget(m_boardName);
	leftSideLayout->addWidget(dimensionGroup);
	leftSideLayout->addWidget(symmetryGroup);
	leftSideLayout->addWidget(m_undoAll);
	if (!m_originalName.isEmpty())
		leftSideLayout->addWidget(m_deleteBoard);
	leftSideLayout->addStretch();

	mainLayout->addLayout(leftSideLayout);
	mainLayout->addWidget(brb);
	mainLayout->setStretchFactor(leftSideLayout, 0);
	mainLayout->setStretchFactor(brb, 10);

	superLayout->addLayout(mainLayout);
	superLayout->addLayout(buttonRow);

	setLayout(superLayout);
	m_saveChanges->setDefault(true);

	// hook up signals and slots
	connect(m_horizontalDimension, SIGNAL(activated(const QString &)), this, SLOT(parametersChanged(const QString &)));
	connect(m_horizontalDimension, SIGNAL(activated(const QString &)), this, SLOT(symmetryChanged()));
	connect(m_verticalDimension, SIGNAL(activated(const QString &)), this, SLOT(parametersChanged(const QString &)));
	connect(m_verticalDimension, SIGNAL(activated(const QString &)), this, SLOT(symmetryChanged()));
	connect(m_boardName, SIGNAL(textEdited(const QString &)), this, SLOT(parametersChanged(const QString &)));
	connect(m_saveChanges, SIGNAL(clicked()), this, SLOT(accept()));
	connect(m_cancel, SIGNAL(clicked()), this, SLOT(reject()));
	connect(m_undoAll, SIGNAL(clicked()), this, SLOT(undoAllChanges()));
	connect(m_deleteBoard, SIGNAL(clicked()), this, SLOT(deleteBoard()));
	connect(m_horizontalSymmetry, SIGNAL(stateChanged(int)), this, SLOT(symmetryChanged()));
	connect(m_verticalSymmetry, SIGNAL(stateChanged(int)), this, SLOT(symmetryChanged()));
	connect(m_diagonalSymmetry, SIGNAL(stateChanged(int)), this, SLOT(symmetryChanged()));
	
	setWindowTitle(tr("Configure Board - Quackle"));

	// sync game board with control states and draw board
	ostringstream boardStream;
	QUACKLE_BOARD_PARAMETERS->Serialize(boardStream);
	m_serializedOriginalBoard = boardStream.str();
	
	parametersChanged(QString());
	symmetryChanged();
}
Esempio n. 30
0
//-----------------------------------------------------------------------------
SplashInstaller::SplashInstaller (QWidget *aParent, const char *aName, bool aInit)
  : QWidget(aParent), mGui(!aInit)
{
  setObjectName(aName);
  KGlobal::dirs()->addResourceType("ksplashthemes", "data", "ksplash/Themes");

  if (!mGui)
    return;

  QHBoxLayout* hbox = new QHBoxLayout( this );
  hbox->setMargin( 0 );

  QVBoxLayout* leftbox = new QVBoxLayout(  );
  hbox->addLayout( leftbox );
  hbox->setStretchFactor( leftbox, 1 );

  mThemesList = new ThemeListBox(this);
  mThemesList->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
  connect(mThemesList, SIGNAL(currentRowChanged(int)), SLOT(slotSetTheme(int)));
  connect(mThemesList, SIGNAL(filesDropped(KUrl::List)), SLOT(slotFilesDropped(KUrl::List)));
  leftbox->addWidget(mThemesList);

  mBtnNew = new KPushButton( KIcon("get-hot-new-stuff"), i18n("Get New Themes..."), this );
  mBtnNew->setToolTip(i18n("Get new themes from the Internet"));
  mBtnNew->setWhatsThis(i18n("You need to be connected to the Internet to use this action. A dialog will display a list of themes from the http://www.kde.org website. Clicking the Install button associated with a theme will install this theme locally."));
  leftbox->addWidget( mBtnNew );
  connect(mBtnNew, SIGNAL(clicked()), SLOT(slotNew()));

  mBtnAdd = new KPushButton( KIcon("document-import"), i18n("Install Theme File..."), this );
  mBtnAdd->setToolTip(i18n("Install a theme archive file you already have locally"));
  mBtnAdd->setWhatsThis(i18n("If you already have a theme archive locally, this button will unpack it and make it available for KDE applications"));
  leftbox->addWidget( mBtnAdd );
  connect(mBtnAdd, SIGNAL(clicked()), SLOT(slotAdd()));

  mBtnRemove = new KPushButton( KIcon("edit-delete"), i18n("Remove Theme"), this );
  mBtnRemove->setToolTip(i18n("Remove the selected theme from your disk"));
  mBtnRemove->setWhatsThis(i18n("This will remove the selected theme from your disk."));
  mBtnRemove->setEnabled( false );
  leftbox->addWidget( mBtnRemove );
  connect(mBtnRemove, SIGNAL(clicked()), SLOT(slotRemove()));

  mBtnTest = new KPushButton( KIcon("document-preview"), i18n("Test Theme"), this );
  mBtnTest->setToolTip(i18n("Test the selected theme"));
  mBtnTest->setWhatsThis(i18n("This will test the selected theme."));
  mBtnTest->setEnabled( false );
  leftbox->addWidget( mBtnTest );
  connect(mBtnTest, SIGNAL(clicked()), SLOT(slotTest()));

  QVBoxLayout* rightbox = new QVBoxLayout(  );
  hbox->addLayout( rightbox );
  hbox->setStretchFactor( rightbox, 3 );

  QScrollArea* scrollarea = new QScrollArea(this);
  scrollarea->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
  mPreview = new QLabel(this);
  scrollarea->setWidget(mPreview);
  mPreview->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
  mPreview->setMinimumSize(QSize(320,240));
  mPreview->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
  rightbox->addWidget(scrollarea);
  rightbox->setStretchFactor( scrollarea, 3 );

  mText = new QTextEdit(this);
  mText->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
  mText->setMinimumSize(mText->sizeHint().width(), 7 * mText->fontMetrics().height());
  mText->setReadOnly(true);
  rightbox->addWidget(mText);
  rightbox->setStretchFactor( mText, 1 );


  readThemesList();
  load();
}