ConstraintDialog::ConstraintDialog(ConstraintCanvas * c) : QDialog(0, "ConstraintVisibilityDialog", TRUE, 0), constraint(c) { setCaption(TR("Constraints visibility dialog")); Q3VBoxLayout * vbox = new Q3VBoxLayout(this); vbox->setMargin(5); table = new ConstraintTable(this, constraint); vbox->addWidget(table); vbox->addWidget(new QLabel(this)); Q3HBoxLayout * hbox; hbox = new Q3HBoxLayout(vbox); cb_visible = new QCheckBox(TR("Specify visible elements rather than hidden ones"), this); cb_visible->setChecked(constraint->indicate_visible); hbox->addWidget(cb_visible); QPushButton * showall = new QPushButton(TR("Show all"), this); QPushButton * hideall = new QPushButton(TR("Hide all"), this); QPushButton * hideinherited = new QPushButton(TR("Hide inherited"), this); QSize bs = hideinherited->sizeHint(); showall->setFixedSize(bs); hideall->setFixedSize(bs); hideinherited->setFixedSize(bs); hbox->addWidget(new QLabel(this)); hbox->addWidget(showall); hbox->addWidget(new QLabel(this)); hbox->addWidget(hideall); hbox->addWidget(new QLabel(this)); hbox->addWidget(hideinherited); hbox->addWidget(new QLabel(this)); connect(showall, SIGNAL(clicked()), this, SLOT(show_all())); connect(hideall, SIGNAL(clicked()), this, SLOT(hide_all())); connect(hideinherited, SIGNAL(clicked()), this, SLOT(hide_inherited())); vbox->addWidget(new QLabel(this)); hbox = new Q3HBoxLayout(vbox); hbox->setMargin(5); QPushButton * ok = new QPushButton(TR("&OK"), this); QPushButton * cancel = new QPushButton(TR("&Cancel"), this); ok->setDefault(TRUE); bs = cancel->sizeHint(); ok->setFixedSize(bs); cancel->setFixedSize(bs); hbox->addWidget(ok); hbox->addWidget(cancel); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); }
int main(int argc, char** argv) { // Initialise the program KCmdLineArgs::init(argc, argv, "kexidbcomboboxtest", 0, KLocalizedString(), "", KLocalizedString(), true); KApplication* app = new KApplication(true, true); // Look for installed database drivers KDbDriverManager manager; KDbDriver::InfoHash drvs = manager.driversInfo(); // Set up a combo box and a quit widget in a new container QWidget* vbox = new QWidget(); Q3VBoxLayout* vbLayout = new Q3VBoxLayout(vbox); KexiDBDriverComboBox* all = new KexiDBDriverComboBox(vbox, drvs); KexiDBDriverComboBox* srvOnly = new KexiDBDriverComboBox(vbox, drvs, KexiDBDriverComboBox::ShowServerDrivers); QPushButton* quit = new QPushButton("Quit", vbox); vbLayout->addWidget(all); // Combobox listing all drivers vbLayout->addWidget(srvOnly); // Combobox only drivers for DB servers vbLayout->addWidget(quit); // Show the whole lot QObject::connect(quit, SIGNAL(clicked()), app, SLOT(quit())); vbox->show(); app->exec(); delete app; }
LCDRange::LCDRange( QWidget *parent, const char *name ): QWidget( parent, name ) { //QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" ); QLCDNumber *lcd = new QLCDNumber( 2 ); lcd->setSegmentStyle(QLCDNumber::Filled); //slider = new QSlider( Horizontal, this, "slider" ); slider = new QSlider( Horizontal); slider->setRange( 0, 99 ); slider->setValue( 0 ); //设置滑块为焦点代理。当想要给LCDRange一个键盘焦点,滑块就会注意到它。 setFocusProxy( slider ); //这里把slider的valueChanged信号分别连接到display和自定义的valueChanged上面 connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)) ); //这里两种方式实现信号的连接,利用标准信号发出自定义信号。 //connect( slider, SIGNAL(valueChanged(int)), // SIGNAL(valueChanged(int)) ); connect( slider, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)) ); //这里利用另外的方式实现添加到VBox,而不用继承QVBox类 Q3VBoxLayout *layout = new Q3VBoxLayout; layout->addWidget(lcd); layout->addWidget(slider); setLayout(layout); }
ConfigForm::ConfigForm(int aCurrentIntervalValue, QWidget *parent, const char *name, bool modal, Qt::WFlags f) : QDialog( parent, name, modal, f ), mApplyButton(kNULL), mCancelButton(kNULL) { mMinVal_Sec = float(kMIN_POLLING_INT) / 1000.f; mMaxVal_Sec = float(kMAX_POLLING_INT) / 1000.f; REG_DBGMSG1("ARPDBG: min val = ", mMinVal_Sec); REG_DBGMSG1("ARPDBG: max val = ", mMaxVal_Sec); REG_DBGCON("ConfigForm"); // note aCurrentIntervalValue is in milliseconds - convert to // seconds for GUI entry this->setCaption( "Configure Polling" ); resize( 150, 150 ); // create the layouts for the form Q3VBoxLayout *lFormLayout = new Q3VBoxLayout(this, 10, 10, "configformlayout"); Q3HBoxLayout *lButtonLayout = new Q3HBoxLayout(6, "configbuttonlayout"); lFormLayout->addWidget(new QLabel("Enter interval value (seconds) \n" "Valid range: " +QString::number(mMinVal_Sec) +" - "+QString::number(mMaxVal_Sec) +" (2 d.p.)", this)); mLineEdit = new QLineEdit( this ); double lVal = (double) aCurrentIntervalValue/1000; mLineEdit->setText(QString::number(lVal, 'g', 3)); mLineEdit->setValidator( new QDoubleValidator(mLineEdit, "dbleavlidator" ) ); lFormLayout->addWidget( mLineEdit); mApplyButton = new QPushButton("Apply", this, "Applybutton"); \ mApplyButton->setAutoDefault(FALSE); QToolTip::add(mApplyButton, "Apply to steerer"); connect(mApplyButton, SIGNAL(clicked()), this, SLOT(applySlot())); mCancelButton = new QPushButton("Cancel", this, "cancelbutton"); mCancelButton->setAutoDefault(FALSE); connect(mCancelButton, SIGNAL(clicked()), this, SLOT( reject())); mCancelButton->setMinimumSize(mCancelButton->sizeHint()); mCancelButton->setMaximumSize(mCancelButton->sizeHint()); mApplyButton->setMinimumSize(mCancelButton->sizeHint()); mApplyButton->setMaximumSize(mApplyButton->sizeHint()); lButtonLayout->addWidget(mApplyButton); lButtonLayout->addWidget(mCancelButton); lFormLayout->addLayout(lButtonLayout); }
Dialog::Dialog(BooL & rec, char & lang) : QDialog(0, 0, TRUE), _rec(rec), _lang(lang) { Q3VBoxLayout * vbox = new Q3VBoxLayout(this); Q3HBox * htab; vbox->setMargin(5); // recursive checkbox if (rec) { htab = new Q3HBox(this); htab->setMargin(5); vbox->addWidget(htab); rec_cb = new QCheckBox("Do recursively", htab); } else rec_cb = 0; // langs + cancel buttons htab = new Q3HBox(this); htab->setMargin(5); vbox->addWidget(htab); QPushButton * cpp = new QPushButton("&C++", htab); new QLabel(htab); QPushButton * java = new QPushButton("&Java", htab); new QLabel(htab); QPushButton * idl = new QPushButton("&Idl", htab); new QLabel(htab); QPushButton * php = new QPushButton("P&hp", htab); new QLabel(htab); QPushButton * python = new QPushButton("P&ython", htab); new QLabel(htab); QPushButton * cancel = new QPushButton("&Cancel", htab); new QLabel(htab); QSize bs(cancel->sizeHint()); cpp->setFixedSize(bs); java->setFixedSize(bs); connect(cpp, SIGNAL(clicked()), this, SLOT(accept_cpp())); connect(java, SIGNAL(clicked()), this, SLOT(accept_java())); connect(idl, SIGNAL(clicked()), this, SLOT(accept_idl())); connect(php, SIGNAL(clicked()), this, SLOT(accept_php())); connect(python, SIGNAL(clicked()), this, SLOT(accept_python())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); // help htab = new Q3HBox(this); htab->setMargin(5); vbox->addWidget(htab); new QLabel(htab); new QLabel("Warning : reset the declarations/definitions to\n" "their default value from the 'generation settings'", htab); new QLabel(htab); }
TicTacToe::TicTacToe( bool meFirst, int boardSize, QWidget *parent, const char *name ) : QWidget( parent, name ) { Q3VBoxLayout * l = new Q3VBoxLayout( this, 6 ); // Create a message label message = new QLabel( this ); message->setFrameStyle( Q3Frame::WinPanel | Q3Frame::Sunken ); message->setAlignment( Qt::AlignCenter ); l->addWidget( message ); // Create the game board and connect the signal finished() to this // gameOver() slot board = new TicTacGameBoard( meFirst, boardSize, this ); connect( board, SIGNAL(finished()), SLOT(gameOver()) ); l->addWidget( board ); // Create a horizontal frame line Q3Frame *line = new Q3Frame( this ); line->setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken ); l->addWidget( line ); // Create the combo box for deciding who should start, and // connect its clicked() signals to the buttonClicked() slot whoStarts = new QComboBox( this ); whoStarts->insertItem( "Opponent starts" ); whoStarts->insertItem( "You start" ); l->addWidget( whoStarts ); whoStarts->setEnabled(false); whoStarts->setCurrentIndex(meFirst); // Create the push buttons and connect their clicked() signals // to this right slots. connect( board, SIGNAL(myMove(int)), this, SIGNAL(myMove(int))); connect( board, SIGNAL(stateChanged()), this, SLOT(newState())); newGame = new QPushButton( "Play!", this ); connect( newGame, SIGNAL(clicked()), SLOT(newGameClicked()) ); newGame->setEnabled(false); quit = new QPushButton( "Quit", this ); connect( quit, SIGNAL(clicked()), this, SIGNAL(closing()) ); Q3HBoxLayout * b = new Q3HBoxLayout; l->addLayout( b ); b->addWidget( newGame ); b->addWidget( quit ); newState(); //board->newGame(); newGameClicked(); }
XListDialog::XListDialog( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "XListDialog" ); Q3VBoxLayout * XListDialogLayout = new Q3VBoxLayout( this, 11, 6, "XListDialogLayout"); Q3HBoxLayout * layout13 = new Q3HBoxLayout( 0, 0, 6, "layout13"); _altFrame = new Q3Frame( this, "_altFrame" ); _altFrame->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, 0, 0, _altFrame->sizePolicy().hasHeightForWidth() ) ); _altFrame->setFrameShape( Q3Frame::NoFrame ); _altFrame->setFrameShadow( Q3Frame::Raised ); layout13->addWidget( _altFrame ); Q3VBoxLayout * layout12 = new Q3VBoxLayout( 0, 0, 6, "layout12"); _close = new QPushButton( tr( "&Close" ), this, "_close" ); _close->setAccel( QKeySequence( tr( "Alt+C" ) ) ); layout12->addWidget( _close ); _select = new QPushButton( tr( "&Select" ), this, "_select" ); _select->setAccel( QKeySequence( tr( "Alt+S" ) ) ); _select->setEnabled(FALSE); layout12->addWidget( _select ); QSpacerItem* spacer = new QSpacerItem( 20, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ); layout12->addItem( spacer ); layout13->addLayout( layout12 ); XListDialogLayout->addLayout( layout13 ); _listLabel = new QLabel( tr( "List:" ), this, "_listLabel" ); XListDialogLayout->addWidget( _listLabel ); _list = new XListView( this, "_list" ); XListDialogLayout->addWidget( _list ); setCaption( tr( "XListDialog" ) ); resize( QSize(420, 380).expandedTo(minimumSizeHint()) ); //clearWState( WState_Polished ); setTabOrder(_list, _select); setTabOrder(_select, _close); setTabOrder(_close, _list); _select->setFocus(); // signals and slots connections connect( _close, SIGNAL( clicked() ), this, SLOT( sClose() ) ); connect( _select, SIGNAL( clicked() ), this, SLOT( sSelect() ) ); connect( _list, SIGNAL( itemSelected(int) ), _select, SLOT( animateClick() ) ); connect( _list, SIGNAL( valid(bool) ), _select, SLOT( setEnabled(bool) ) ); }
void StocksDialog::createDataPage () { QWidget *w = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(0); barEdit = new BarEdit(w); QString s = tr("Open"); QString s2 = "Open"; barEdit->createField(s, s2, FALSE); s = tr("High"); s2 = "High"; barEdit->createField(s, s2, FALSE); s = tr("Low"); s2 = "Low"; barEdit->createField(s, s2, FALSE); s = tr("Close"); s2 = "Close"; barEdit->createField(s, s2, FALSE); s = tr("Volume"); s2 = "Volume"; barEdit->createField(s, s2, FALSE); connect(barEdit, SIGNAL(signalDeleteRecord()), this, SLOT(deleteRecord())); connect(barEdit, SIGNAL(signalSaveRecord()), this, SLOT(saveRecord())); connect(barEdit, SIGNAL(signalSearch(QDateTime)), this, SLOT(slotDateSearch(QDateTime))); connect(barEdit, SIGNAL(signalFirstRecord()), this, SLOT(slotFirstRecord())); connect(barEdit, SIGNAL(signalLastRecord()), this, SLOT(slotLastRecord())); connect(barEdit, SIGNAL(signalPrevRecord()), this, SLOT(slotPrevRecord())); connect(barEdit, SIGNAL(signalNextRecord()), this, SLOT(slotNextRecord())); vbox->addWidget(barEdit); addTab(w, tr("Data")); }
// ------------------------------------------------------------------------------------------------- TriggerWidget::TriggerWidget(QWidget* parent, const char* name) throw () : QWidget(parent, name) { Q3VBoxLayout* boxLayout = new Q3VBoxLayout(this, 0, 0); Q3HBox* hbox = new Q3HBox(this); hbox->setSpacing(2); // create the checkboxes with their labels for (int i = 0; i < NUMBER_OF_BITS_PER_BYTE; i++) { Q3VBox* box = new Q3VBox(hbox); box->setSpacing(2); m_labels[i] = new QLabel(QString::number(i+1), box); m_labels[i]->setAlignment(Qt::AlignHCenter); m_checkboxes[i] = new QCheckBox(box); m_checkboxes[i]->setTristate(true); m_checkboxes[i]->setNoChange(); connect(m_checkboxes[i], SIGNAL(stateChanged(int)), SLOT(valueChangedHandler())); } boxLayout->addWidget(hbox); boxLayout->addStretch(5); }
RenameImagesDialog::RenameImagesDialog(const KUrl::List& images, KIPI::Interface* interface, QWidget* parent) : KDialog(parent) { setCaption(i18n("Rename Images")); setModal(true); setButtons(Help | User1 | Close); setButtonText(User1, i18n("&Start")); setDefaultButton(Close); // About data and help button. m_about = new KIPIPlugins::KPAboutData(ki18n("Batch-rename images"), QByteArray(), KAboutData::License_GPL, ki18n("A Kipi plugin to batch-rename images"), ki18n("(c) 2003-2007, Gilles Caulier")); m_about->addAuthor(ki18n("Gilles Caulier"), ki18n("Author and maintainer"), "caulier dot gilles at gmail dot com"); DialogUtils::setupHelpButton(this, m_about); // gui QWidget* box = new QWidget(this); setMainWidget(box); Q3VBoxLayout* lay = new Q3VBoxLayout(box); m_widget = new RenameImagesWidget(box, interface, images); lay->addWidget(m_widget); connect(this, SIGNAL(user1Clicked()), m_widget, SLOT(slotStart())); adjustSize(); }
//=========================================================== // void ImportWizard::setupDst() { m_dstPage = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_dstPage, KDialog::marginHint()); m_dstConn = new KexiConnSelectorWidget(Kexi::connset(), "kfiledialog:///ProjectMigrationDestinationDir", KAbstractFileWidget::Saving, m_dstPage); m_dstConn->hideHelpers(); //me: Can't connect m_dstConn->m_fileDlg here, it doesn't exist yet //connect(this, SLOT(next()), m_dstConn->m_fileDlg, SIGNAL(accepted())); vbox->addWidget(m_dstConn); connect(m_dstConn, SIGNAL(connectionItemExecuted(ConnectionDataLVItem*)), this, SLOT(next())); // m_dstConn->hideHelpers(); m_dstConn->showSimpleConn(); //anyway, db files will be _saved_ m_dstConn->fileWidget->setMode(KexiStartupFileWidget::SavingFileBasedDB); // m_dstConn->hideHelpers(); // m_dstConn->m_file->btn_advanced->hide(); // m_dstConn->m_file->label->hide(); // m_dstConn->m_file->lbl->hide(); //m_dstConn->m_file->spacer7->hide(); //js dstNewDBName = new KLineEdit(dstControls); // dstNewDBName->setText(i18n("Enter new database name here")); addPage(m_dstPage, i18n("Select Location for Destination Database")); }
CColorDialog::CColorDialog (QWidget * parent, const char *name, F4lmApp * p): QWidget (parent, name) { //QColor renk; //renk=QColorDialog::getColor(renk,this); realp = p; Q3VBoxLayout *topLayout = new Q3VBoxLayout (this); Q3ButtonGroup *ToolsButtonGroup =new Q3ButtonGroup (this, "ToolsButtonGroup"); ToolsButtonGroup->setGeometry (QRect (150, 70, 71, 291)); ToolsButtonGroup->setLineWidth (0); ToolsButtonGroup->setTitle (trUtf8 ("")); QToolButton *ToolButton1 =new QToolButton (ToolsButtonGroup, "ToolButton1"); ToolButton1->setGeometry (QRect (0, 10, 30, 30)); ToolButton1->setText (trUtf8 ("CC")); connect (ToolButton1, SIGNAL (clicked ()), this,SLOT (slotColorChooser ())); QToolButton *ToolButton2 =new QToolButton (ToolsButtonGroup, "ToolButton2"); ToolButton2->setGeometry (QRect (30, 10, 30, 30)); ToolButton2->setText (trUtf8 ("...")); //CColorSwatches* s=new CColorSwatches(this,"color_swatches",p); topLayout->addWidget (ToolsButtonGroup); //topLayout->addWidget(s); }
//=========================================================== // void ImportWizard::setupIntro() { m_introPage = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_introPage, KDialog::marginHint()); QLabel *lblIntro = new QLabel(m_introPage); lblIntro->setAlignment(Qt::AlignTop | Qt::AlignLeft); lblIntro->setWordWrap(true); QString msg; if (m_predefinedConnectionData) { //predefined import: server source msg = i18n("<qt>Database Importing wizard is about to import \"%1\" database " "<nobr>(connection %2)</nobr> into a Kexi database.</qt>", m_predefinedDatabaseName, m_predefinedConnectionData->serverInfoString()); } else if (!m_predefinedDatabaseName.isEmpty()) { //predefined import: file source //! @todo this message is currently ok for files only KMimeType::Ptr mimeTypePtr = KMimeType::mimeType(m_predefinedMimeType); if (mimeTypePtr.isNull()) KexiDBWarn << QString("'%1' mimetype not installed!").arg(m_predefinedMimeType); msg = i18n( "<qt>Database Importing wizard is about to import <nobr>\"%1\"</nobr> file " "of type \"%2\" into a Kexi database.</qt>", QDir::convertSeparators(m_predefinedDatabaseName), mimeTypePtr ? mimeTypePtr->comment() : "???"); } else { msg = i18n("Database Importing wizard allows you to import an existing database " "into a Kexi database."); } lblIntro->setText(msg + "\n\n" + i18n("Click \"Next\" button to continue or \"Cancel\" button to exit this wizard.")); vbox->addWidget(lblIntro); addPage(m_introPage, i18n("Welcome to the Database Importing Wizard")); }
ReferenceDialog::ReferenceDialog(BrowserNode * bn) : QDialog(0, "Referenced By dialog", FALSE, Qt::WDestructiveClose) { the = this; target = bn; setCaption(TR("Referenced By dialog")); Q3VBoxLayout * vbox = new Q3VBoxLayout(this); vbox->setMargin(5); QString s = target->get_name(); s += TR(" is referenced by :"); vbox->addWidget(new QLabel(s, this)); results = new Q3ComboBox(FALSE, this); vbox->addWidget(results); Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox); QPushButton * search_b = new QPushButton(TR("Recompute"), this); QPushButton * close_b = new QPushButton(TR("Close"), this); hbox->setMargin(5); hbox->addWidget(search_b); hbox->addWidget(select_b = new QPushButton(TR("Select"), this)); hbox->addWidget(mark_unmark_b = new QPushButton(TR("Unmark"), this)); hbox->addWidget(mark_them_b = new QPushButton(TR("Mark them"), this)); hbox->addWidget(unmark_all_b = new QPushButton(TR("Unmark all"), this)); hbox->addWidget(close_b); search_b->setDefault(TRUE); connect(search_b, SIGNAL(clicked()), this, SLOT(compute())); connect(select_b, SIGNAL(clicked()), this, SLOT(select())); connect(close_b, SIGNAL(clicked()), this, SLOT(reject())); connect(mark_unmark_b, SIGNAL(clicked()), this, SLOT(mark_unmark())); connect(mark_them_b, SIGNAL(clicked()), this, SLOT(mark_them())); connect(unmark_all_b, SIGNAL(clicked()), this, SLOT(unmark_all())); connect(results, SIGNAL(activated(int)), this, SLOT(selected(int))); compute(); open_dialog(this); }
KexiCSVInfoLabel::KexiCSVInfoLabel(const QString& labelText, QWidget* parent) : QWidget(parent) { Q3VBoxLayout *vbox = new Q3VBoxLayout(this, 0, KDialog::spacingHint()); Q3HBoxLayout *hbox = new Q3HBoxLayout(this); vbox->addLayout(hbox); m_leftLabel = new QLabel(labelText, this); m_leftLabel->setMinimumWidth(130); m_leftLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); m_leftLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); m_leftLabel->setWordWrap(true); hbox->addWidget(m_leftLabel); m_iconLbl = new QLabel(this); m_iconLbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); m_iconLbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); m_fnameLbl = new QLabel(this); m_fnameLbl->setOpenExternalLinks(true); m_fnameLbl->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); m_fnameLbl->setFocusPolicy(Qt::NoFocus); m_fnameLbl->setTextFormat(Qt::PlainText); m_fnameLbl->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 1, 0)); m_fnameLbl->setLineWidth(1); m_fnameLbl->setFrameStyle(Q3Frame::Box); m_fnameLbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); m_fnameLbl->setWordWrap(true); hbox->addSpacing(5); hbox->addWidget(m_iconLbl); hbox->addWidget(m_fnameLbl, 1, Qt::AlignVCenter | Qt::AlignLeft #ifdef __GNUC__ #warning TODO | Qt::TextWordWrap #else #pragma WARNING( TODO | Qt::TextWordWrap ) #endif ); hbox->addSpacing(10); m_commentLbl = new QLabel(this); m_commentLbl->setOpenExternalLinks(true); m_commentLbl->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); m_commentLbl->setFocusPolicy(Qt::NoFocus); m_commentLbl->setTextFormat(Qt::PlainText); m_commentLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_commentLbl->setLineWidth(1); m_commentLbl->setFrameStyle(QFrame::Box); m_commentLbl->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); m_commentLbl->setWordWrap(true); hbox->addWidget(m_commentLbl, 0, Qt::AlignVCenter | Qt::AlignRight #ifdef __GNUC__ #warning TODO | Qt::TextWordWrap #else #pragma WARNING( TODO | Qt::TextWordWrap ) #endif ); m_separator = new Q3Frame(this); m_separator->setFrameShape(Q3Frame::HLine); m_separator->setFrameShadow(Q3Frame::Sunken); vbox->addWidget(m_separator); }
void StocksDialog::createFundamentalsPage () { QWidget *w = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(5); Setting fund; QString s, s2; index->getFundamentals(symbol, s2); fund.parse(s2); s = tr("Fundamentals: last updated "); s2 = "updateDate"; QString s3; fund.getData(s2, s3); s.append(s3); fund.remove(s2); QStringList key; fund.getKeyList(key); key.sort(); vbox->addSpacing(10); QLabel *label = new QLabel(s, w); vbox->addWidget(label); fundView = new Q3ListView(w); fundView->addColumn(tr("Description")); fundView->addColumn(tr("Value")); vbox->addWidget(fundView); int loop; for (loop = 0; loop < (int) key.count(); loop++) { fund.getData(key[loop], s); new Q3ListViewItem(fundView, key[loop], s); } if (! key.count()) new Q3ListViewItem(fundView, tr("No data available.")); addTab(w, tr("Fundamentals")); }
FileListDialog::FileListDialog(QWidget* parent, QString const& _dialogTitle, QString const& _listTitle, char const * _filters[]) : QDialog(parent, "FileListDialog", TRUE), // TRUE = modal dialog list_(NULL), delButton_(NULL), fileDialog_(NULL), modified_(false) { resize(300, 200); setCaption(_dialogTitle); Q3VBoxLayout * topBox = new Q3VBoxLayout(this, 0, -1, "boxLayout"); Q3VGroupBox * fileBox = new Q3VGroupBox(this, "fileBox"); list_ = new Q3ListBox(fileBox, "list"); Q3HBox * fileButtonsBox = new Q3HBox(fileBox, "fileButtons"); QPushButton * addButton = new QPushButton("Add...", fileButtonsBox); delButton_ = new QPushButton("Remove", fileButtonsBox); fileDialog_ = new Q3FileDialog(this, "config file dialog", TRUE); topBox->addSpacing(10); topBox->addWidget(fileBox); fileBox->setTitle(_listTitle); topBox->addSpacing(10); Q3HBoxLayout * dialogButtonsBox = new Q3HBoxLayout(topBox, -1, "hBoxLayout"); QSpacerItem * dBSpace = new QSpacerItem(0, 0); QPushButton * okButton = new QPushButton("OK", this); QPushButton * cancelButton = new QPushButton("Cancel", this); topBox->addSpacing(5); dialogButtonsBox->addItem(dBSpace); dialogButtonsBox->addWidget(okButton); dialogButtonsBox->addSpacing(5); dialogButtonsBox->addWidget(cancelButton); dialogButtonsBox->addSpacing(5); okButton->setDefault(true); static const char * filters[3] = { "all files (*)", NULL }; fileDialog_->setCaption("File open dialog"); fileDialog_->setFilters((_filters == NULL)? filters : _filters); // connect the dialogs functionality connect(okButton, SIGNAL(clicked()), SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), SLOT(reject())); connect(addButton, SIGNAL(clicked()), SLOT(add())); connect(delButton_, SIGNAL(clicked()), SLOT(del())); selectListItem(); }
ScannerPage::ScannerPage (QWidget *w, DBIndex *i) : QWidget (w) { chartIndex = i; idir.setFilter(QDir::Files); Q3VBoxLayout *vbox = new Q3VBoxLayout(this); vbox->setMargin(0); vbox->setSpacing(5); search = new QLineEdit(this); search->setText("*"); connect(search, SIGNAL(textChanged(const QString &)), this, SLOT(searchChanged(const QString &))); QToolTip::add(search, tr("List Filter, e.g. s* or sb*")); vbox->addWidget(search); list = new Q3ListBox(this); connect(list, SIGNAL(contextMenuRequested(Q3ListBoxItem *, const QPoint &)), this, SLOT(rightClick(Q3ListBoxItem *))); connect(list, SIGNAL(highlighted(const QString &)), this, SLOT(scannerSelected(const QString &))); connect(list, SIGNAL(doubleClicked(Q3ListBoxItem *)), this, SLOT(doubleClick(Q3ListBoxItem *))); vbox->addWidget(list); menu = new QMenu(this); menu->insertItem(QPixmap(newchart), tr("&New Scanner Ctrl+N"), this, SLOT(newScanner())); menu->insertItem(QPixmap(openitem), tr("&Open Scanner Ctrl+O"), this, SLOT(openScanner())); menu->insertItem(QPixmap(deleteitem), tr("&Delete Scanner Ctrl+D"), this, SLOT(deleteScanner())); menu->insertItem(QPixmap(renameitem), tr("&Rename Scanner Ctrl+R"), this, SLOT(renameScanner())); menu->insertItem(QPixmap(macro), tr("R&un Scanner Ctrl+U"), this, SLOT(runScanner())); menu->insertSeparator(-1); menu->insertItem(QPixmap(help), tr("&Help Ctrl+H"), this, SLOT(slotHelp())); Q3Accel *a = new Q3Accel(this); connect(a, SIGNAL(activated(int)), this, SLOT(slotAccel(int))); a->insertItem(Qt::CTRL+Qt::Key_N, NewScanner); a->insertItem(Qt::CTRL+Qt::Key_O, OpenScanner); a->insertItem(Qt::CTRL+Qt::Key_D, DeleteScanner); a->insertItem(Qt::CTRL+Qt::Key_R, RenameScanner); a->insertItem(Qt::CTRL+Qt::Key_U, RunScanner); a->insertItem(Qt::CTRL+Qt::Key_H, Help); refreshList(); scannerSelected(QString()); }
//=========================================================== // void ImportWizard::setupFinish() { m_finishPage = new QWidget(this); m_finishPage->hide(); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_finishPage, KDialog::marginHint()); m_finishLbl = new QLabel(m_finishPage); m_finishLbl->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_finishLbl->setWordWrap(true); vbox->addWidget(m_finishLbl); m_openImportedProjectCheckBox = new QCheckBox(i18n("Open imported project"), m_finishPage); m_openImportedProjectCheckBox->setChecked(true); vbox->addSpacing(KDialog::spacingHint()); vbox->addWidget(m_openImportedProjectCheckBox); vbox->addStretch(1); addPage(m_finishPage, i18n("Success")); }
OptionsExportMusixtex::OptionsExportMusixtex(KSharedConfigPtr &conf, QWidget *parent, const char *name) : OptionsPage(conf, parent, name) { // Create option widgets Q3VButtonGroup *layoutGroup = new Q3VButtonGroup(i18n("MusiXTeX Layout"), this); showBarNumber = new QCheckBox(i18n("Show Bar Number"), layoutGroup); showStr = new QCheckBox(i18n("Show Tuning"), layoutGroup); showPageNumber = new QCheckBox(i18n("Show Page Number"), layoutGroup); exportModeGroup = new Q3VButtonGroup(i18n("Export as..."), this); exportMode[0] = new QRadioButton(i18n("Tabulature"), exportModeGroup); exportMode[1] = new QRadioButton(i18n("Notes"), exportModeGroup); tabSizeGroup = new Q3VButtonGroup(i18n("Tab Size"), this); tabSize[0] = new QRadioButton(i18n("Smallest"), tabSizeGroup); tabSize[1] = new QRadioButton(i18n("Small"), tabSizeGroup); tabSize[2] = new QRadioButton(i18n("Normal"), tabSizeGroup); tabSize[3] = new QRadioButton(i18n("Big"), tabSizeGroup); always = new QCheckBox(i18n("Always show this dialog on export"), this); // Set widget layout Q3VBoxLayout *box = new Q3VBoxLayout(this); box->addWidget(layoutGroup); box->addWidget(tabSizeGroup); box->addWidget(exportModeGroup); box->addStretch(1); box->addWidget(always); box->activate(); // Fill in current config tabSizeGroup->setButton(Settings::texTabSize()); showBarNumber->setChecked(Settings::texShowBarNumber()); showStr->setChecked(Settings::texShowStr()); showPageNumber->setChecked(Settings::texShowPageNumber()); exportModeGroup->setButton(Settings::texExportMode()); always->setChecked(config->group("MusiXTeX").readEntry("AlwaysShow", TRUE)); }
//=========================================================== // void ImportWizard::setupImporting() { m_importingPage = new QWidget(this); m_importingPage->hide(); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_importingPage, KDialog::marginHint()); m_lblImportingTxt = new QLabel(m_importingPage); m_lblImportingTxt->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_lblImportingTxt->setWordWrap(true); m_lblImportingErrTxt = new QLabel(m_importingPage); m_lblImportingErrTxt->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_lblImportingErrTxt->setWordWrap(true); m_progressBar = new QProgressBar(m_importingPage); m_progressBar->setRange(0, 100); m_progressBar->hide(); vbox->addWidget(m_lblImportingTxt); vbox->addWidget(m_lblImportingErrTxt); vbox->addStretch(1); QWidget *options_widget = new QWidget(m_importingPage); vbox->addWidget(options_widget); QVBoxLayout *options_vbox = new QVBoxLayout(options_widget); options_vbox->setSpacing(KDialog::spacingHint()); m_importOptionsButton = new KPushButton(KIcon("configure"), i18n("Advanced Options"), options_widget); connect(m_importOptionsButton, SIGNAL(clicked()), this, SLOT(slotOptionsButtonClicked())); options_vbox->addWidget(m_importOptionsButton); options_vbox->addStretch(1); vbox->addWidget(m_progressBar); vbox->addStretch(2); m_importingPage->show(); addPage(m_importingPage, i18n("Importing")); }
//=========================================================== // void ImportWizard::setupImportType() { m_importTypePage = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_importTypePage, KDialog::marginHint()); m_importTypeButtonGroup = new Q3VButtonGroup(m_importTypePage); m_importTypeButtonGroup->setLineWidth(0); vbox->addWidget(m_importTypeButtonGroup); (void)new QRadioButton(i18n("Structure and data"), m_importTypeButtonGroup); (void)new QRadioButton(i18n("Structure only"), m_importTypeButtonGroup); m_importTypeButtonGroup->setExclusive(true); m_importTypeButtonGroup->setButton(0); addPage(m_importTypePage, i18n("Select Type of Import")); }
StringListEdit::StringListEdit(const QStringList &list, UntitledList* unamedList, QWidget *parent) : QDialog(parent), ask(false), duplicatesOk(false), _suggestedStringsList(unamedList) { addCaption = "Add String"; addLabel = "String:"; editCaption = "Edit String"; editLabel = addLabel; Q3HBoxLayout *hbox = new Q3HBoxLayout(this, 5, 5); Q3VBoxLayout *vbox = new Q3VBoxLayout; listBox = new Q3ListBox(this); connect(listBox, SIGNAL(currentChanged(Q3ListBoxItem*)), this, SLOT(updateButtons())); hbox->addWidget(listBox, 1); QPushButton *button = new QPushButton(tr("&Add..."), this); connect(button, SIGNAL(clicked()), this, SLOT(addString())); vbox->addWidget(button); editButton = new QPushButton(tr("&Edit..."), this); connect(editButton, SIGNAL(clicked()), this, SLOT(editString())); vbox->addWidget(editButton); removeButton = new QPushButton(tr("&Remove..."), this); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeString())); vbox->addWidget(removeButton); upButton = new QPushButton(tr("&Up"), this); connect(upButton, SIGNAL(clicked()), this, SLOT(moveUp())); vbox->addWidget(upButton); downButton = new QPushButton(tr("&Down"), this); connect(downButton, SIGNAL(clicked()), this, SLOT(moveDown())); vbox->addWidget(downButton); vbox->addStretch(1); button = new QPushButton(tr("OK"), this); connect(button, SIGNAL(clicked()), this, SLOT(accept())); vbox->addWidget(button); button = new QPushButton(tr("Cancel"), this); connect(button, SIGNAL(clicked()), this, SLOT(reject())); vbox->addWidget(button); hbox->addLayout(vbox); setList(list); }
OperationListDialog::OperationListDialog(const char * m, Q3PtrList<BrowserOperation> & l) : QDialog(0, m, TRUE) { setCaption(m); move(QCursor::pos()); Q3VBoxLayout * vbox = new Q3VBoxLayout(this); Q3HBoxLayout * hbox; vbox->setMargin(5); cb = new Q3ComboBox(FALSE, this); vbox->addWidget(cb); for (BrowserOperation * oper = l.first(); oper; oper = l.next()) { QString s = ((BrowserNode *) oper->parent())->get_name() + QString("::") + oper->get_data()->definition(TRUE, FALSE); if (((OperationData *) oper->get_data())->get_is_abstract()) cb->insertItem("[a] " + s); else cb->insertItem(s); } hbox = new Q3HBoxLayout(vbox); hbox->setMargin(5); QPushButton * ok = new QPushButton(TR("&OK"), this); QPushButton * cancel = new QPushButton(TR("&Cancel"), this); QSize bs(cancel->sizeHint()); ok->setDefault(TRUE); ok->setFixedSize(bs); cancel->setFixedSize(bs); hbox->addWidget(ok); hbox->addWidget(cancel); UmlDesktop::limitsize_center(this, previous_size, 0.8, 0.8); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); }
void ImportWizard::arriveSrcDBPage() { if (fileBasedSrcSelected()) { //! @todo Back button doesn't work after selecting a file to import //moved showPage(m_dstTypePage); } else if (!m_srcDBName) { m_srcDBPage->hide(); kDebug() << "Looks like we need a project selector widget!"; KexiDB::ConnectionData* condata = m_srcConn->selectedConnectionData(); if (condata) { m_prjSet = new KexiProjectSet(*condata); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_srcDBPage, KDialog::marginHint()); m_srcDBName = new KexiProjectSelectorWidget(m_srcDBPage, m_prjSet); vbox->addWidget(m_srcDBName); m_srcDBName->label()->setText(i18n("Select source database you wish to import:")); } m_srcDBPage->show(); } }
F4lmView::F4lmView (F4lmDoc * pDoc, QWidget * parent, const char *name, Qt::WindowFlags wflags) :QWidget (parent, name, wflags) { setName ("F4lmView"); dad = (F4lmApp *) parentWidget ()->parent ()->parent (); doc = pDoc; resize (700, 600); setIcon (QPixmap ((const char **) main_doc_ico_xpm)); layerNum = 1; defSceneHeight = 440; defSceneWidth = 550; defSceneRect = QRect (600, 600, defSceneWidth, defSceneHeight); Q3VBoxLayout * topLayout = new Q3VBoxLayout (this); CLayer * layer1 = new CLayer (this, "layer 1"); mainCanvas = new CCanvas (this, "mc"); CSceneRect * defrect = new CSceneRect (defSceneRect, mainCanvas); defrect->setBrush (QColor (255, 255, 255)); defrect->setZ (1<<31);//smallest integer..... //qDebug("%d",1<<31); defrect->show (); mainCanvas->resize (defSceneWidth + defSceneWidth + 600,defSceneHeight + defSceneHeight + 600); mainCanvas->setBackgroundColor (QColor (208, 208, 208)); doc->pLayerList->append (layer1); canvasViewer = new canview (mainCanvas, this, "Canvas viewer"); canvasViewer->scrollBy (550, 550); topLayout->addWidget (canvasViewer); defObjID = 0; //this means first color for drawing is black defObjCOLOR = QColor (0, 0, 0); //qDebug(QString::number(defObjCOLOR.red())); /*boundaries=new QValueVector<canvasBoundaries>(); canvasBoundaries tcanvb; tcanvb.canvasLimitsForTable[0][0]=layerNum; tcanvb.canvasLimitsForTable[0][1]=0; tcanvb.canvasLimitsForTable[0][2]=0; boundaries->push_back(tcanvb); */ }
void StocksDialog::createSplitPage () { QWidget *w = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(5); Q3GridLayout *grid = new Q3GridLayout(vbox); grid->setMargin(0); grid->setSpacing(5); QLabel *label = new QLabel(tr("Split Date"), w); grid->addWidget(label, 0, 0); Bar bar; db->getLastBar(bar); QDateTime dt; bar.getDate(dt); if (! bar.getEmptyFlag()) splitDate = new Q3DateEdit(dt.date(), w); else splitDate = new Q3DateEdit(QDate::currentDate(), w); splitDate->setOrder(Q3DateEdit::YMD); grid->addWidget(splitDate, 0, 1); label = new QLabel(tr("Split Ratio"), w); grid->addWidget(label, 1, 0); splitRatio = new QLineEdit("2:1", w); grid->addWidget(splitRatio, 1, 1); QPushButton *button = new QPushButton(tr("Perform Split"), w); connect(button, SIGNAL(clicked()), this, SLOT(split())); vbox->addWidget(button); vbox->addStretch(1); addTab(w, tr("Split")); }
ClassListDialog::ClassListDialog(const char * m, const Q3ValueList<BrowserClass *> & l) : QDialog(0, m, TRUE) { setCaption(m); move(QCursor::pos()); Q3VBoxLayout * vbox = new Q3VBoxLayout(this); Q3HBoxLayout * hbox; vbox->setMargin(5); cb = new Q3ComboBox(FALSE, this); vbox->addWidget(cb); Q3ValueList<BrowserClass *>::ConstIterator end = l.end(); Q3ValueList<BrowserClass *>::ConstIterator it; for (it = l.begin(); it != end; ++it) if (!(*it)->deletedp()) cb->insertItem((*it)->full_name(TRUE)); hbox = new Q3HBoxLayout(vbox); hbox->setMargin(5); QPushButton * ok = new QPushButton(TR("&OK"), this); QPushButton * cancel = new QPushButton(TR("&Cancel"), this); QSize bs(cancel->sizeHint()); ok->setDefault(TRUE); ok->setFixedSize(bs); cancel->setFixedSize(bs); hbox->addWidget(ok); hbox->addWidget(cancel); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); UmlDesktop::limitsize_center(this, previous_size, 0.8, 0.8); }
CodAddMsgDialog::CodAddMsgDialog(CodObjCanvas * from, CodObjCanvas * to, CodMsgSupport * i, ColDiagramView * v, bool fo) : QDialog(0, "add msg dialog", TRUE), in(i), view(v), forward(fo) { setCaption(TR("Add message dialog")); Q3VBoxLayout * vbox = new Q3VBoxLayout(this); Q3HBoxLayout * hbox; vbox->setMargin(5); hbox = new Q3HBoxLayout(vbox); hbox->setMargin(10); QLabel * label1 = new QLabel(TR("Add message to %1", to->get_full_name()), this); label1->setAlignment(Qt::AlignCenter); hbox->addWidget(label1); Q3Grid * grid = new Q3Grid(2, this); vbox->addWidget(grid); new QLabel(TR("rank : "), grid); cbrank = new Q3ComboBox(FALSE, grid); ColMsgList all_in; ColMsgList all_out; from->get_all_in_all_out(all_in, all_out); QStringList new_ones; foreach (ColMsg *m, all_out) { QString s = m->next_hierarchical_rank(); if ((s.find('.') != - 1) && (ColMsg::find(s, all_out) == 0)) { cbrank->insertItem(QString::number(m->get_rank() + 1) + " : " + s); new_ones.append(s); } }
//=========================================================== // void ImportWizard::setupSrcConn() { m_srcConnPage = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_srcConnPage, KDialog::marginHint()); m_srcConn = new KexiConnSelectorWidget(Kexi::connset(), "kfiledialog:///ProjectMigrationSourceDir", KAbstractFileWidget::Opening, m_srcConnPage); m_srcConn->hideConnectonIcon(); m_srcConn->showSimpleConn(); QSet<QString> excludedFilters; //! @todo remove when support for kexi files as source prj is added in migration excludedFilters += KexiDB::defaultFileBasedDriverMimeType(); excludedFilters += "application/x-kexiproject-shortcut"; excludedFilters += "application/x-kexi-connectiondata"; m_srcConn->fileWidget->setExcludedFilters(excludedFilters); // m_srcConn->hideHelpers(); vbox->addWidget(m_srcConn); addPage(m_srcConnPage, i18n("Select Location for Source Database")); }