KoResourceItemChooser::KoResourceItemChooser( KoAbstractResourceServerAdapter * resourceAdapter, QWidget *parent ) : QWidget( parent ), d( new Private() ) { Q_ASSERT(resourceAdapter); d->model = new KoResourceModel(resourceAdapter, this); d->view = new KoResourceItemView(this); d->view->setModel(d->model); d->view->setItemDelegate( new KoResourceItemDelegate( this ) ); d->view->setSelectionMode( QAbstractItemView::SingleSelection ); connect( d->view, SIGNAL(clicked( const QModelIndex & ) ), this, SLOT(activated ( const QModelIndex & ) ) ); d->buttonGroup = new QButtonGroup( this ); d->buttonGroup->setExclusive( false ); QGridLayout* layout = new QGridLayout( this ); layout->addWidget( d->view, 0, 0, 1, 5 ); QPushButton *button = new QPushButton( this ); button->setIcon( SmallIcon( "list-add" ) ); button->setToolTip( i18n("Import") ); button->setEnabled( true ); d->buttonGroup->addButton( button, Button_Import ); layout->addWidget( button, 1, 0 ); button = new QPushButton( this ); button->setIcon( SmallIcon( "list-remove" ) ); button->setToolTip( i18n("Delete") ); button->setEnabled( false ); d->buttonGroup->addButton( button, Button_Remove ); layout->addWidget( button, 1, 1 ); button = new QPushButton( this ); button->setIcon( SmallIcon( "bookmarks" ) ); button->setToolTip( i18n("Download") ); button->setEnabled( true ); button->hide(); d->buttonGroup->addButton( button, Button_GhnsDownload ); layout->addWidget( button, 1, 3 ); button = new QPushButton( this ); button->setIcon( SmallIcon( "download" ) ); button->setToolTip( i18n("Share") ); button->setEnabled( false ); button->hide(); d->buttonGroup->addButton( button, Button_GhnsUpload); layout->addWidget( button, 1, 4 ); connect( d->buttonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotButtonClicked( int ) )); layout->setColumnStretch( 0, 1 ); layout->setColumnStretch( 1, 1 ); layout->setColumnStretch( 2, 2 ); layout->setSpacing( 0 ); layout->setMargin( 3 ); updateRemoveButtonState(); }
ShutdownImpl::ShutdownImpl( QWidget* parent, Qt::WFlags fl ) : QDialog( parent, fl ) { setupUi(this); timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) ); connect( reboot, SIGNAL(clicked()), this, SLOT(rebootClicked())); connect( restart, SIGNAL(clicked()), this, SLOT(restartClicked())); connect( quit, SIGNAL(clicked()), this, SLOT(quitClicked())); connect( shut, SIGNAL(clicked()), this, SLOT(shutdownClicked())); // connect( cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()) ); progressBar->hide(); QtopiaApplication::hideInputMethod(); #ifdef QT_QWS_SL5XXX QPushButton *sb = Shutdown::shutdown; sb->hide(); #endif // Bootmenu on GTA04, described here: https://github.com/radekp/gta04-init bool hasBootmenu = QDir("/boot/gta04-init").exists(); bootmenuCheck->setVisible(hasBootmenu); if(hasBootmenu) { disableBootmenu(); // normally we want the bootmenu disabled } connect(bootmenuCheck, SIGNAL(stateChanged(int)), this, SLOT(bootmenuStateChanged(int))); }
void Dialog::setButton(ButtonChoice choice, Dialog::Role role, const QString & t, bool def) { QPushButton * button = ui->left; if (choice == Dialog::Right) { button = ui->right; } if (role == Dialog::Hide) { button->hide(); return; } button->show(); if (role == Dialog::Accept) { connect(button, SIGNAL(clicked()), this, SLOT(accept())); } if (role == Dialog::Reject) { connect(button, SIGNAL(clicked()), this, SLOT(reject())); } button->setText(t); this->setFocus(); button->setDefault(def); }
void HorizontalTabWidget::hideTab(QWidget * widget, bool hide) { int index = m_pageStack->indexOf(widget); OS_ASSERT(index >= 0); int currentIndex = m_pageStack->currentIndex(); if(currentIndex == index){ if(currentIndex + 1 < m_pageStack->count()){ currentIndex++; } else if (currentIndex != 0) { currentIndex = 0; } else { // index and currentIndex are both 0 // can't hide both the tab and the page return; } } QPushButton * button = nullptr; button = m_tabButtons.at(index); OS_ASSERT(button); if(hide){ button->hide(); } else { button->show(); } setCurrentIndex(currentIndex); }
int main(int argc, char *argv[]) { Q_INIT_RESOURCE(tetrix); //! [1] QApplication app(argc, argv); QScriptEngine engine; QScriptValue Qt = engine.newQMetaObject(QtMetaObject::get()); Qt.setProperty("App", engine.newQObject(&app)); engine.globalObject().setProperty("Qt", Qt); //! [1] #ifndef QT_NO_SCRIPTTOOLS QScriptEngineDebugger debugger; debugger.attachTo(&engine); QMainWindow *debugWindow = debugger.standardWindow(); debugWindow->resize(1024, 640); #endif //! [2] evaluateFile(engine, ":/tetrixpiece.js"); evaluateFile(engine, ":/tetrixboard.js"); evaluateFile(engine, ":/tetrixwindow.js"); //! [2] //! [3] TetrixUiLoader loader; QFile uiFile(":/tetrixwindow.ui"); uiFile.open(QIODevice::ReadOnly); QWidget *ui = loader.load(&uiFile); uiFile.close(); QScriptValue ctor = engine.evaluate("TetrixWindow"); QScriptValue scriptUi = engine.newQObject(ui, QScriptEngine::ScriptOwnership); QScriptValue tetrix = ctor.construct(QScriptValueList() << scriptUi); //! [3] QPushButton *debugButton = qFindChild<QPushButton*>(ui, "debugButton"); #ifndef QT_NO_SCRIPTTOOLS QObject::connect(debugButton, SIGNAL(clicked()), debugger.action(QScriptEngineDebugger::InterruptAction), SIGNAL(triggered())); QObject::connect(debugButton, SIGNAL(clicked()), debugWindow, SLOT(show())); #else debugButton->hide(); #endif //! [4] ui->resize(550, 370); ui->show(); qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); return app.exec(); //! [4] }
// React to a click on a day button, by removing it from the list void ByWeekdayColumnWidget::onDayClicked() { QPushButton *dayButton = qobject_cast<QPushButton*>(this->sender()); // Remove the last number button listLayout->removeWidget(dayButton); dayButton->hide(); dayButton->deleteLater(); // Remove the day from the internal list days.removeOne(reverse ? -dayButton->text().toInt() : dayButton->text().toInt()); }
void ARehabMainWindow::slot_LoadFile(void) { if (!dirFiles.exists()) { dirFiles.mkdir("./ARehabFiles"); } this->arehabFileMetadata.clear(); if (fileDialog) { fileDialog->setFileMode(QFileDialog::ExistingFile); fileDialog->setDefaultSuffix(".arehab"); if (fileDialog->exec()) { QString arehabFileURL = fileDialog->selectedFiles().first(); if (arehabFileURL != "") { this->resetGuiState1(); this->resetGuiState2(); this->resetGuiState3(); this->arehabFileMetadata.arehabFileURL = QUrl::fromLocalFile(arehabFileURL).toLocalFile(); this->arehabFileMetadata.load(this->arehabFileMetadata.arehabFileURL); ui.txARehabFile->setText(this->arehabFileMetadata.metadataFileURL); ui.txNombreEjercicio->setText(this->arehabFileMetadata.exerciseName); ui.txDescription->setPlainText(this->arehabFileMetadata.description); this->jointSelectorWidget->setJointSelectorModel(this->arehabFileMetadata.jointsInvolved); if (arehabFileMetadata.numRepetitions > 0) { unsigned int buttonID = (arehabFileMetadata.numRepetitions / 5) - 1; //ui.btGroupRepeats->buttonToggled(buttonID, true); for (unsigned int i = 0; i < ui.btGroupRepeats->buttons().size(); ++i) { QPushButton * bt = reinterpret_cast<QPushButton*>(ui.btGroupRepeats->button(i)); if (bt) { if (i == buttonID){ bt->show(); bt->setChecked(true); } else { bt->hide(); } } } } this->fileReaderController->OpenImputFile(arehabFileMetadata.arehabFileURL.toStdString()); this->showGUIState1(); } } } }
WeeklyTimeSheetReport::WeeklyTimeSheetReport( QWidget* parent ) : ReportPreviewWindow( parent ) , m_weekNumber( 0 ) , m_yearOfWeek( 0 ) , m_rootTask( 0 ) , m_activeTasksOnly( false ) , m_report( 0 ) { QPushButton* upload = uploadButton(); connect(upload, SIGNAL(clicked()), SLOT(slotUploadTimesheet()) ); if (!HttpJob::credentialsAvailable()) upload->hide(); }
void Tile::Reset() { isRunning = 0; Moves=0; updateMoves(); for (int i = 1; i < 16; i++) { QPushButton *button = idtoButton(i); QString str; button->show(); button->setText(str.setNum(i)); } QPushButton *button = idtoButton(16); button->hide(); button->setText("16"); }
void DetachedWidgetController::DisableButtons(bool val) { if(val) { for(int i=0; i<buttongroup->layout()->count();i++) { QPushButton * item = dynamic_cast<QPushButton*>(buttongroup->layout()->itemAt(i)->widget()); if(item) { item->hide(); } } } }
ProgressDialogPage::ProgressDialogPage(QWidget *parent) : QWizardPage(parent) { progressDialog = new QProgressDialog(this); progressDialog->setWindowFlags(Qt::Widget); //cruel hack! downgrade the dialog :P progressDialog->setAutoClose(false); progressDialog->setAutoReset(false); //another hack! disable the cancel button :P QPushButton *nullButton = new QPushButton; progressDialog->setCancelButton(nullButton); nullButton->hide(); QGridLayout *l = new QGridLayout; l->addWidget(progressDialog); setLayout(l); }
void SysTrayIconPlugin::apply() { bool systrayon = _config->readValue("systrayon").toBool(); if (_systrayicon != NULL) { if (systrayon && QSystemTrayIcon::isSystemTrayAvailable()) { _systrayicon->show(); _mainwin->setQuitOnClose(false); } else { _systrayicon->hide(); _mainwin->setQuitOnClose(true); } } // replace main window's quit button by a close button or restore quit button if option was unchecked. QFrame *mainFrmMain = _mainwin->findChild<QFrame*>("frmMain"); QPushButton *mainBtnQuit = _mainwin->findChild<QPushButton*>("btnQuit"); if ( systrayon && _mainButtonBar == NULL ) { _mainButtonBar = new SysTrayMainIconifyButtons(mainFrmMain); mainFrmMain->layout()->addWidget(_mainButtonBar); connect(_mainButtonBar->btnIconify, SIGNAL(clicked()), this, SLOT(minimize())); connect(_mainButtonBar->btnQuit, SIGNAL(clicked()), _mainwin, SLOT(quit())); } bool wantreplacequitbutton; #ifdef KLF_MAC_HIDE_INSTEAD // the user should disable "Dock into systray" altogether if he doesn't want this // as the only way he would have to hide the app is through the mac menu anyway wantreplacequitbutton = true; #else wantreplacequitbutton = _config->readValue("replacequitbutton").toBool(); #endif if ( systrayon && wantreplacequitbutton ) { mainBtnQuit->hide(); _mainButtonBar->show(); } else if (_mainButtonBar != NULL) { _mainButtonBar->hide(); mainBtnQuit->show(); } }
void voxUI::showSpecialChars() { QRegExp rx("specialChar_(\\d+)"); QList<QPushButton*> allPushButtons = ui->addP->findChildren<QPushButton*>(); QListIterator<QPushButton*> pBIter(allPushButtons); while(pBIter.hasNext()){ QPushButton* next = pBIter.next(); if(next->objectName().contains(rx)){ if(rx.cap(1).toInt() < curSpecialList->size()){ next->setText(curSpecialList->at(rx.cap(1).toInt())); } else{ next->hide(); } } } }
ShutdownImpl::ShutdownImpl( QWidget* parent, Qt::WFlags fl ) : QDialog( parent, fl ) { setupUi(this); timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) ); connect( reboot, SIGNAL(clicked()), this, SLOT(rebootClicked())); connect( restart, SIGNAL(clicked()), this, SLOT(restartClicked())); connect( quit, SIGNAL(clicked()), this, SLOT(quitClicked())); connect( shut, SIGNAL(clicked()), this, SLOT(shutdownClicked())); // connect( cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()) ); progressBar->hide(); QtopiaApplication::hideInputMethod(); #ifdef QT_QWS_SL5XXX QPushButton *sb = Shutdown::shutdown; sb->hide(); #endif }
void DkFileAssociationsPreference::createLayout() { QStringList fileFilters = Settings::param().app().openFilters; mModel = new QStandardItemModel(this); mModel->setObjectName("fileModel"); for (int rIdx = 1; rIdx < fileFilters.size(); rIdx++) mModel->appendRow(getItems(fileFilters.at(rIdx), checkFilter(fileFilters.at(rIdx), Settings::param().app().browseFilters), checkFilter(fileFilters.at(rIdx), Settings::param().app().registerFilters))); mModel->setHeaderData(0, Qt::Horizontal, tr("Filter")); mModel->setHeaderData(1, Qt::Horizontal, tr("Browse")); mModel->setHeaderData(2, Qt::Horizontal, tr("Register")); QTableView* filterTableView = new QTableView(this); filterTableView->setModel(mModel); filterTableView->setSelectionBehavior(QAbstractItemView::SelectRows); filterTableView->verticalHeader()->hide(); //filterTableView->horizontalHeader()->hide(); filterTableView->setShowGrid(false); filterTableView->resizeColumnsToContents(); filterTableView->resizeRowsToContents(); filterTableView->setWordWrap(false); QPushButton* openDefault = new QPushButton(tr("Set as Default Viewer"), this); openDefault->setObjectName("openDefault"); // now the final widgets QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(filterTableView); #ifdef Q_OS_WIN layout->addWidget(openDefault); #else openDefault->hide(); #endif }
TexamSummary::TexamSummary(Texam* exam, bool cont, QWidget* parent) : QDialog(parent), m_exam(exam), m_state(e_discard), m_closeButt(0), m_examButton(0), m_mainWIndow(parent) { #if defined (Q_OS_ANDROID) showMaximized(); #else setWindowTitle(tr("Exam results")); setWindowIcon(QIcon(Tpath::img("startExam"))); #endif QHBoxLayout *lay = new QHBoxLayout(); //------- left layout ----------------------- m_leftLay = new QVBoxLayout(); QString font20 = "<b><big>"; QLabel *userNameLab = new QLabel(tr("student:") + QString(" %2<u>%1</u></b>").arg(exam->userName()).arg(font20), this); m_leftLay->addWidget(userNameLab, 0, Qt::AlignCenter); TroundedLabel *questNrLab = new TroundedLabel("<center>" + tr("Number of questions:") + QString("%2 %1</big></b>").arg(exam->count()).arg(font20) + QString("<br>%1: %2%3</big></b>").arg(TexTrans::corrAnswersNrTxt()).arg(font20). arg(exam->count() - exam->mistakes() - exam->halfMistaken()) + QString("<br>%1: %2%3</big></b>").arg(TexTrans::mistakesNrTxt()).arg(font20).arg(exam->mistakes()) + QString("<br>%1: %2%3</big></b>").arg(TexTrans::halfMistakenTxt()).arg(font20).arg(exam->halfMistaken()) ,this); m_leftLay->addWidget(questNrLab); QVBoxLayout *timeLay = new QVBoxLayout(); QGroupBox *timeGr = new QGroupBox(tr("times:"), this); TroundedLabel *timeLab = new TroundedLabel("<table>" + row2(TexTrans::totalTimetxt(), TexamView::formatedTotalTime(exam->totalTime() * 1000)) + row2(tr("Time taken to answer"), TexamView::formatedTotalTime(exam->workTime() * 1000)) + row2(TexTrans::averAnsverTimeTxt(), QString("%1 s"). arg((qreal)exam->averageReactonTime()/10.0, 0, 'f', 1, '0')) + "</table>", this); timeLab->setContentsMargins(5, 5, 5, 5); timeLay->addWidget(timeLab); timeGr->setLayout(timeLay); m_leftLay->addWidget(timeGr); QPushButton *analyseButt = new QPushButton(tr("Analyze"), this); analyseButt->setIcon(QIcon(Tpath::img("charts"))); analyseButt->setIconSize(QSize(48, 48)); if (exam->count() == 0) analyseButt->setDisabled(true); #if defined (Q_OS_ANDROID) // TODO: delete if mobile version will support analysis analyseButt->hide(); m_sendButt = new QPushButton(qTR("QShortcut", "Send"), this); m_sendButt->setIcon(QIcon(Tpath::img("nootka-exam"))); m_sendButt->setIconSize(QSize(48, 48)); #endif m_okButt = new QPushButton(qTR("QPlatformTheme", "Close"), this); if (cont) { m_okButt->setText(qTR("QWizard", "Continue")); m_okButt->setIcon(QIcon(Tpath::img("exam"))); m_closeButt = new QPushButton(qTR("QPlatformTheme", "Close"), this); m_closeButt->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton)); m_closeButt->setIconSize(QSize(48, 48)); connect(m_closeButt, &QPushButton::clicked, this, &TexamSummary::closeSlot); } else m_okButt->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton)); m_okButt->setIconSize(QSize(48, 48)); auto buttLay = new QHBoxLayout; buttLay->addWidget(m_okButt); buttLay->addWidget(analyseButt); m_leftLay->addStretch(1); m_leftLay->addLayout(buttLay); #if defined (Q_OS_ANDROID) m_leftLay->addWidget(m_sendButt); #endif if (cont) m_leftLay->addWidget(m_closeButt); lay->addLayout(m_leftLay); //------- right layout ----------------------- QVBoxLayout *rightLay = new QVBoxLayout(); TlevelPreview *levelWdg = new TlevelPreview(this); rightLay->addWidget(levelWdg); levelWdg->setLevel(*(exam->level())); levelWdg->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); QVBoxLayout *resLay = new QVBoxLayout(); QGroupBox *resGr = new QGroupBox(tr("Results:"), this); QString effStr; if (exam->mistakes() || exam->halfMistaken()) { // effStr = row2(TexamView::mistakesNrTxt(), QString::number(exam->mistakes())); // effStr += row2(TexamView::corrAnswersNrTxt(), QString::number(exam->count()-exam->mistakes())); float wAccid = 0.0, wKey = 0.0, wNote = 0.0, wOctave = 0.0, wStyle = 0.0, wPos = 0.0, wString = 0.0, wTotal; float wInto = 0.0, wLittle = 0.0, wPoor = 0.0; for(int i=0; i<exam->count(); i++) { if (!exam->question(i)->isCorrect()) { if(exam->question(i)->wrongAccid()) wAccid++; if(exam->question(i)->wrongKey()) wKey++; if(exam->question(i)->wrongNote()) wNote++; if(exam->question(i)->wrongOctave()) wOctave++; if(exam->question(i)->wrongStyle()) wStyle++; if(exam->question(i)->wrongPos()) wPos++; if(exam->question(i)->wrongString()) wString++; if(exam->question(i)->wrongIntonation()) wInto++; if(exam->question(i)->littleNotes()) wLittle++; if(exam->question(i)->poorEffect()) wPoor++; } } effStr += "<tr><td colspan=\"2\">-------- " + tr("Kinds of mistakes") + QStringLiteral(": --------</td></tr>"); wTotal = wAccid + wKey + wNote + wOctave + wStyle + wPos + wString + wInto + wLittle + wPoor; QString cp = QStringLiteral("%)"); // closing percent '%)' if (wNote) effStr += row2(tr("Wrong notes"), QString("%1 (").arg(wNote) + QString::number(qRound(wNote * 100.0 / wTotal)) + cp); if (wAccid) effStr += row2(tr("Wrong accidentals"), QString("%1 (").arg(wAccid) + QString::number(qRound(wAccid * 100.0 / wTotal)) + cp); if (wKey) effStr += row2(tr("Wrong key signatures"), QString("%1 (").arg(wKey) + QString::number(qRound(wKey * 100.0 / wTotal)) + cp); if (wOctave) effStr += row2(tr("Wrong octaves"), QString("%1 (").arg(wOctave) + QString::number(qRound(wOctave * 100.0 / wTotal)) + cp); if (wStyle) effStr += row2(tr("Wrong note names"), QString("%1 (").arg(wStyle)) + QString::number(qRound(wStyle * 100.0 / wTotal)) + cp; if (wPos) effStr += row2(tr("Wrong positions on guitar"), QString("%1 (").arg(wPos) + QString::number(qRound(wPos * 100.0 / wTotal)) + cp); if (wString) effStr += row2(tr("Wrong strings"), QString("%1 (").arg(wString) + QString::number(qRound(wString * 100.0 / wTotal)) + cp); if (wInto) effStr += row2(tr("Out of tune"), QString("%1 (").arg(wInto) + QString::number(qRound(wInto * 100.0 / wTotal)) + cp); if (wLittle) effStr += row2(QApplication::translate("AnswerText", "little valid notes", "the amount of correct notes in an answer is little"), QString("%1 (").arg(wLittle) + QString::number(qRound(wLittle * 100.0 / wTotal)) + cp); if (wPoor) effStr += row2(QApplication::translate("AnswerText", "poor effectiveness"), QString("%1 (").arg(wPoor) + QString::number(qRound(wPoor * 100.0 / wTotal)) + cp); } TroundedLabel *resLab = new TroundedLabel(QStringLiteral("<table>") + row2(TexTrans::effectTxt(), QString::number(qRound(exam->effectiveness())) + QStringLiteral("%")) + effStr + QStringLiteral("</table>"), this); resLab->setContentsMargins(5, 5, 5, 5); resLay->addWidget(resLab); resGr->setLayout(resLay); rightLay->addWidget(resGr); lay->addLayout(rightLay); #if defined (Q_OS_ANDROID) auto ta = new TtouchArea(this); ta->setLayout(lay); auto touchLay = new QVBoxLayout; touchLay->addWidget(ta); setLayout(touchLay); #else setLayout(lay); #endif connect(analyseButt, &QPushButton::clicked, this, &TexamSummary::analyseSlot); connect(m_okButt, &QPushButton::clicked, this, &TexamSummary::continueSlot); #if defined (Q_OS_ANDROID) connect(m_sendButt, &QPushButton::clicked, this, &TexamSummary::sendExamSlot); #endif if (m_exam->isExercise()) setForExercise(); }
DocumentTextEditor::DocumentTextEditor(const CollectionInfo &info, const QString &json, bool readonly /* = false */, QWidget *parent) : QDialog(parent), _info(info), _readonly(readonly) { QRect screenGeometry = QApplication::desktop()->availableGeometry(); int horizontalMargin = (int)(screenGeometry.width() * 0.35); int verticalMargin = (int)(screenGeometry.height() * 0.20); QSize size(screenGeometry.width() - horizontalMargin, screenGeometry.height() - verticalMargin); QSettings settings("3T", "Robomongo"); if (settings.contains("DocumentTextEditor/size")) { restoreWindowSettings(); } else { resize(size); } setWindowFlags(Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); Indicator *collectionIndicator = new Indicator(GuiRegistry::instance().collectionIcon(), QtUtils::toQString(_info._ns.collectionName())); Indicator *databaseIndicator = new Indicator(GuiRegistry::instance().databaseIcon(), QtUtils::toQString(_info._ns.databaseName())); Indicator *serverIndicator = new Indicator(GuiRegistry::instance().serverIcon(), QtUtils::toQString(detail::prepareServerAddress(_info._serverAddress))); QPushButton *validate = new QPushButton("Validate"); validate->setIcon(qApp->style()->standardIcon(QStyle::SP_MessageBoxInformation)); VERIFY(connect(validate, SIGNAL(clicked()), this, SLOT(onValidateButtonClicked()))); _queryText = new FindFrame(this); _configureQueryText(); _queryText->sciScintilla()->setText(json); // clear modification state after setting the content _queryText->sciScintilla()->setModified(false); VERIFY(connect(_queryText->sciScintilla(), SIGNAL(textChanged()), this, SLOT(onQueryTextChanged()))); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->setContentsMargins(2, 0, 5, 1); hlayout->setSpacing(0); hlayout->addWidget(serverIndicator, 0, Qt::AlignLeft); hlayout->addWidget(databaseIndicator, 0, Qt::AlignLeft); hlayout->addWidget(collectionIndicator, 0, Qt::AlignLeft); hlayout->addStretch(1); QDialogButtonBox *buttonBox = new QDialogButtonBox (this); buttonBox->setOrientation(Qt::Horizontal); buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()))); VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()))); QHBoxLayout *bottomlayout = new QHBoxLayout(); bottomlayout->addWidget(validate); bottomlayout->addStretch(1); bottomlayout->addWidget(buttonBox); QVBoxLayout *layout = new QVBoxLayout(); // show top bar only if we have info for it if (_info.isValid()) layout->addLayout(hlayout); layout->addWidget(_queryText); layout->addLayout(bottomlayout); setLayout(layout); if (_readonly) { validate->hide(); buttonBox->button(QDialogButtonBox::Save)->hide(); _queryText->sciScintilla()->setReadOnly(true); } }
void ImageImporter::initGUI() { m_ImageImporterLayout = new QVBoxLayout( this, 11, 6, "ImageImporterLayout"); m_grpSource = new QGroupBox( this, "grpSource" ); m_grpSource->setTitle( i18n( "Source" ) ); m_grpSource->setColumnLayout(0, Qt::Vertical ); m_grpSource->layout()->setSpacing( 6 ); m_grpSource->layout()->setMargin( 11 ); m_grpSourceLayout = new QGridLayout( m_grpSource->layout() ); m_grpSourceLayout->setAlignment( Qt::AlignTop ); m_cmbSourceDevice = new QComboBox( false, m_grpSource, "cmbSourceDevice" ); m_grpSourceLayout->addWidget( new QLabel(m_cmbSourceDevice, i18n( "Device:" ), m_grpSource, "lblDevice" ), 0, 0 ); connect(m_cmbSourceDevice, SIGNAL(highlighted(const QString& )), SLOT(slotUpdateMountStatus())); // m_cmbSourceDevice->setEditable( true ); m_grpSourceLayout->addWidget( m_cmbSourceDevice, 0, 1 ); QWhatsThis::add(m_cmbSourceDevice, i18n( "Here you can select a device which you can <i>mount</i> and then import your images from.<br>" "Mountpoints are only listed, if they are mountable by this user!" )); m_btnMountDevice = new QPushButton( m_grpSource, "btnMountDevice" ); m_btnMountDevice->setText( i18n( "Mount" ) ); //m_btnMountDevice->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, 0, 0, m_btnMountDevice->sizePolicy().hasHeightForWidth() ) ); m_btnMountDevice->setToggleButton( TRUE ); connect(m_btnMountDevice, SIGNAL(clicked()), SLOT(slotMountDevice())); m_grpSourceLayout->addWidget( m_btnMountDevice, 0, 2 ); QWhatsThis::add(m_btnMountDevice, i18n( "Mounts/Unmounts the currently selected mountpoint." )); m_cmbSourceFolder = new QComboBox( m_grpSource, "txtSourceFolder" ); m_cmbSourceFolder->setEditable(true); m_cmbSourceFolder->setDuplicatesEnabled( false ); m_grpSourceLayout->addWidget( new QLabel(m_cmbSourceFolder, i18n( "Folder:" ), m_grpSource, "lblFolder" ), 1, 0 ); m_grpSourceLayout->addWidget( m_cmbSourceFolder, 1, 1 ); QWhatsThis::add(m_cmbSourceFolder, i18n( "Enter the name of the folder, from where you want to import your Images." )); m_btnSourceFolder = new QPushButton( m_grpSource, "btnSourceFolder" ); m_btnSourceFolder->setText( i18n( "..." ) ); connect(m_btnSourceFolder, SIGNAL(clicked()), SLOT(slotBtnSourceFolder())); m_grpSourceLayout->addWidget( m_btnSourceFolder, 1, 2 ); QWhatsThis::add(m_btnSourceFolder, i18n( "Select the import folder." )); QFrame* line = new QFrame( m_grpSource, "lineSource1" ); line->setFrameShape( QFrame::HLine ); line->setFrameShadow( QFrame::Sunken ); line->setFrameShape( QFrame::HLine ); m_grpSourceLayout->addMultiCellWidget( line, 2, 2, 0, 2 ); m_txtSourceFilename = new QLineEdit( m_grpSource, "txtSourceFilename" ); m_grpSourceLayout->addWidget( new QLabel(m_txtSourceFilename, i18n("Filename:"), m_grpSource, "lblSourceFilename" ), 3, 0 ); m_grpSourceLayout->addMultiCellWidget( m_txtSourceFilename, 3, 3, 1, 2 ); QWhatsThis::add(m_txtSourceFilename, i18n( "Contains a Regular Expression to match the files you want to import." "You can use captures here '()'. These will replace $0 and $1, $2, etc... " "in the output names." )); m_chkIgnoreCase = new QCheckBox("Ignore case", m_grpSource); m_grpSourceLayout->addWidget( m_chkIgnoreCase, 4, 1 ); QWhatsThis::add( m_chkIgnoreCase, i18n( "Toggles, whether the filename-regexp should be matched case sensitive or not" ) ); line = new QFrame( m_grpSource, "lineSource2" ); line->setFrameShape( QFrame::HLine ); line->setFrameShadow( QFrame::Sunken ); line->setFrameShape( QFrame::HLine ); m_grpSourceLayout->addMultiCellWidget( line, 2, 2, 0, 2 ); m_grpSourceLayout->addMultiCellWidget( line, 5, 5, 0, 2 ); m_chkSrcIncludeSubfolders = new QCheckBox( m_grpSource, "chkSrcIncludeSubfolders" ); m_chkSrcIncludeSubfolders->setText( i18n( "Include subfolders" ) ); m_chkSrcIncludeSubfolders->setChecked( true ); m_grpSourceLayout->addMultiCellWidget( m_chkSrcIncludeSubfolders, 6, 6, 1, 2 ); QWhatsThis::add(m_chkSrcIncludeSubfolders, i18n( "If you also want to import files placed in subfolders of the given basefolder, check this." )); m_chkSrcRemoveFilesFromSrc = new QCheckBox( m_grpSource, "chkSrcRemoveFilesFromSource" ); m_chkSrcRemoveFilesFromSrc->setText( i18n( "Remove successfully transfered files from given source (i.e. move the files)" ) ); m_chkSrcRemoveFilesFromSrc->setChecked( true ); m_grpSourceLayout->addMultiCellWidget( m_chkSrcRemoveFilesFromSrc, 7, 7, 1, 2 ); QWhatsThis::add(m_chkSrcRemoveFilesFromSrc, i18n( "If you want the imported images to be removed from the source, check this." )); m_ImageImporterLayout->addWidget( m_grpSource ); m_ImageImporterLayout->addItem(new QSpacerItem( 40, 20, QSizePolicy::Fixed, QSizePolicy::Fixed)); m_groupArchive = new QGroupBox( this, "groupArchive" ); m_groupArchive->setTitle( i18n( "Archive" ) ); m_groupArchive->setCheckable( true ); m_groupArchive->setColumnLayout(0, Qt::Vertical ); m_groupArchive->layout()->setSpacing( 6 ); m_groupArchive->layout()->setMargin( 11 ); m_groupArchiveLayout = new QGridLayout( m_groupArchive->layout() ); m_groupArchiveLayout->setAlignment( Qt::AlignTop ); QWhatsThis::add( m_groupArchive, i18n( "If you want to create a copy of your original images (for security reasons), select this option." ) ); m_txtArchiveBaseFolder = new QLineEdit( m_groupArchive, "txtArchiveBaseFolder" ); connect(m_txtArchiveBaseFolder, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample())); m_groupArchiveLayout->addWidget( m_txtArchiveBaseFolder, 0, 1 ); m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveBaseFolder, i18n( "Base Folder" ), m_groupArchive, "lblArchiveBaseFolder" ), 0, 0 ); QPushButton* btn = new QPushButton(i18n( "..." ), m_groupArchive, "btnArhiveBaseFolder" ); m_groupArchiveLayout->addWidget( btn, 0, 2 ); connect(btn, SIGNAL(clicked()), this, SLOT(slotBtnArchiveBaseFolder())); QWhatsThis::add( m_txtArchiveBaseFolder, i18n( "This is the base folder, all your archived images will be copied to." ) ); m_txtArchiveSubfolders = new QLineEdit( m_groupArchive, "txtArchiveSubfolders" ); connect(m_txtArchiveSubfolders, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample())); m_groupArchiveLayout->addWidget( m_txtArchiveSubfolders, 1, 1 ); m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveSubfolders, i18n( "Subfolders" ), m_groupArchive, "blbArchiveSubfolders" ), 1, 0 ); QWhatsThis::add(m_txtArchiveSubfolders, helpText("For every image a subfolder is created in the base folder.")); m_txtArchiveFilename = new QLineEdit( m_groupArchive, "txtArchiveFilename" ); connect(m_txtArchiveFilename, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateArchiveExample())); m_groupArchiveLayout->addWidget( m_txtArchiveFilename, 2, 1 ); m_groupArchiveLayout->addWidget( new QLabel(m_txtArchiveFilename, i18n( "File RegExp" ), m_groupArchive, "lblArchiveFilename" ), 2, 0 ); QWhatsThis::add(m_txtArchiveFilename, helpText("This is the name of archived image in the subfolder.")); m_chkArchiveLowercase = new QCheckBox( m_groupArchive, "chkArchiveLowercase" ); m_chkArchiveLowercase->setText( i18n( "lowercase filenames" ) ); m_chkArchiveLowercase->setChecked( true ); m_groupArchiveLayout->addMultiCellWidget( m_chkArchiveLowercase, 3, 3, 1, 2 ); QWhatsThis::add(m_chkArchiveLowercase, i18n( "Should your images be translated to lowercase finally?" )); line = new QFrame( m_groupArchive, "lineArchive" ); line->setFrameShape( QFrame::HLine ); line->setFrameShadow( QFrame::Sunken ); line->setFrameShape( QFrame::HLine ); m_groupArchiveLayout->addMultiCellWidget( line, 4, 4, 0, 2 ); m_groupArchiveLayout->addWidget( new QLabel(i18n( "Example" ), m_groupArchive, "lblArchiveExample" ), 5, 0 ); m_lblArchiveExampleString = new KSqueezedTextLabel( m_groupArchive, "kSqueezedTextLabel1" ); m_groupArchiveLayout->addMultiCellWidget( m_lblArchiveExampleString, 5, 5, 1, 2 ); m_ImageImporterLayout->addWidget( m_groupArchive ); m_groupDest = new QGroupBox( this, "groupDest" ); m_groupDest->setTitle( i18n( "Destination" ) ); m_groupDest->setCheckable( FALSE ); m_groupDest->setColumnLayout(0, Qt::Vertical ); m_groupDest->layout()->setSpacing( 6 ); m_groupDest->layout()->setMargin( 11 ); m_groupDestLayout = new QGridLayout( m_groupDest->layout() ); m_groupDestLayout->setAlignment( Qt::AlignTop ); m_cmbDestBasefolder = new QComboBox( m_groupDest, "txtDestBasefolder" ); // m_cmbDestBasefolder->setEditable( true ); m_cmbDestBasefolder->setDuplicatesEnabled( false ); connect(m_cmbDestBasefolder, SIGNAL(highlighted(int)), SLOT(slotUpdateDestExample())); m_groupDestLayout->addWidget( m_cmbDestBasefolder, 0, 1 ); m_groupDestLayout->addWidget( new QLabel(m_cmbDestBasefolder, i18n( "Base Folder" ), m_groupDest, "lblDestBaseFolder" ), 0, 0 ); btn = new QPushButton(i18n( "..." ), m_groupDest, "btnDestBaseFolder" ); m_groupDestLayout->addWidget( btn, 0, 2 ); //this is a temporary hack: it is intended, that someday the user can select an arbitrary folder to copy the images to, // which finally is added to the album. But currently the user only can select from folders here, which are already contained in // the album. btn->hide(); connect(btn, SIGNAL(clicked()), SLOT(slotBtnDestBaseFolder())); m_txtDestSubfolders = new QLineEdit( m_groupDest, "txtDestSubfolders" ); connect(m_txtDestSubfolders, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateDestExample())); m_groupDestLayout->addWidget( m_txtDestSubfolders, 1, 1 ); m_groupDestLayout->addWidget( new QLabel(m_txtDestSubfolders, i18n( "Subfolders" ), m_groupDest, "lblDestSubfolders" ), 1, 0 ); QWhatsThis::add(m_txtDestSubfolders, helpText("Set the name of the subfolders of your images.")); m_txtDestFilename = new QLineEdit( m_groupDest, "txtDestFilename" ); connect(m_txtDestFilename, SIGNAL(textChanged(const QString& )), SLOT(slotUpdateDestExample())); m_groupDestLayout->addWidget( m_txtDestFilename, 2, 1 ); m_groupDestLayout->addWidget( new QLabel(m_txtDestFilename, i18n( "Filename" ), m_groupDest, "lblDestFilename" ), 2, 0 ); QWhatsThis::add(m_txtDestFilename, helpText("Set the name of your images.")); m_chkDestLowercase = new QCheckBox( m_groupDest, "chkDestLowercase" ); m_chkDestLowercase->setText( i18n( "lowercase filenames" ) ); m_chkDestLowercase->setChecked( true ); m_groupDestLayout->addMultiCellWidget( m_chkDestLowercase, 3, 3, 1, 2 ); QWhatsThis::add(m_chkDestLowercase, i18n( "Should your images be translated to lowercase finally?" )); line = new QFrame( m_groupDest, "lineDest" ); line->setFrameShape( QFrame::HLine ); line->setFrameShadow( QFrame::Sunken ); line->setFrameShape( QFrame::HLine ); m_groupDestLayout->addMultiCellWidget( line, 4, 4, 0, 2 ); m_groupDestLayout->addWidget( new QLabel(i18n( "Example" ), m_groupDest, "lblDestExample" ), 5, 0 ); m_lblDestExampleString = new KSqueezedTextLabel( m_groupDest, "lblDestExampleString" ); m_groupDestLayout->addMultiCellWidget( m_lblDestExampleString, 5, 5, 1, 2 ); m_ImageImporterLayout->addWidget( m_groupDest ); QHBoxLayout* btnBottom = new QHBoxLayout( 0, 0, 6, "btnBottom"); btnBottom->addItem(new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )); btn = new QPushButton(i18n( "Import" ), this, "import" ); btnBottom->addWidget( btn ); connect(btn, SIGNAL(clicked()), SLOT(slotImport())); btn = new QPushButton(i18n( "Quit" ), this, "quit" ); btnBottom->addWidget( btn ); connect(btn, SIGNAL(clicked()), SLOT(slotQuit())); btn = new QPushButton(i18n( "Cancel" ), this, "cancel" ); btnBottom->addWidget( btn ); connect(btn, SIGNAL(clicked()), SLOT(reject())); m_ImageImporterLayout->addLayout( btnBottom ); resize( QSize(551, 519).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); }
CompositionWidget::CompositionWidget(QWidget *parent) : QWidget(parent) { CompositionRenderer *view = new CompositionRenderer(this); QGroupBox *mainGroup = new QGroupBox(parent); mainGroup->setTitle(tr("Composition Modes")); QGroupBox *modesGroup = new QGroupBox(mainGroup); modesGroup->setTitle(tr("Mode")); rbClear = new QRadioButton(tr("Clear"), modesGroup); connect(rbClear, SIGNAL(clicked()), view, SLOT(setClearMode())); rbSource = new QRadioButton(tr("Source"), modesGroup); connect(rbSource, SIGNAL(clicked()), view, SLOT(setSourceMode())); rbDest = new QRadioButton(tr("Destination"), modesGroup); connect(rbDest, SIGNAL(clicked()), view, SLOT(setDestMode())); rbSourceOver = new QRadioButton(tr("Source Over"), modesGroup); connect(rbSourceOver, SIGNAL(clicked()), view, SLOT(setSourceOverMode())); rbDestOver = new QRadioButton(tr("Destination Over"), modesGroup); connect(rbDestOver, SIGNAL(clicked()), view, SLOT(setDestOverMode())); rbSourceIn = new QRadioButton(tr("Source In"), modesGroup); connect(rbSourceIn, SIGNAL(clicked()), view, SLOT(setSourceInMode())); rbDestIn = new QRadioButton(tr("Dest In"), modesGroup); connect(rbDestIn, SIGNAL(clicked()), view, SLOT(setDestInMode())); rbSourceOut = new QRadioButton(tr("Source Out"), modesGroup); connect(rbSourceOut, SIGNAL(clicked()), view, SLOT(setSourceOutMode())); rbDestOut = new QRadioButton(tr("Dest Out"), modesGroup); connect(rbDestOut, SIGNAL(clicked()), view, SLOT(setDestOutMode())); rbSourceAtop = new QRadioButton(tr("Source Atop"), modesGroup); connect(rbSourceAtop, SIGNAL(clicked()), view, SLOT(setSourceAtopMode())); rbDestAtop = new QRadioButton(tr("Dest Atop"), modesGroup); connect(rbDestAtop, SIGNAL(clicked()), view, SLOT(setDestAtopMode())); rbXor = new QRadioButton(tr("Xor"), modesGroup); connect(rbXor, SIGNAL(clicked()), view, SLOT(setXorMode())); rbPlus = new QRadioButton(tr("Plus"), modesGroup); connect(rbPlus, SIGNAL(clicked()), view, SLOT(setPlusMode())); rbMultiply = new QRadioButton(tr("Multiply"), modesGroup); connect(rbMultiply, SIGNAL(clicked()), view, SLOT(setMultiplyMode())); rbScreen = new QRadioButton(tr("Screen"), modesGroup); connect(rbScreen, SIGNAL(clicked()), view, SLOT(setScreenMode())); rbOverlay = new QRadioButton(tr("Overlay"), modesGroup); connect(rbOverlay, SIGNAL(clicked()), view, SLOT(setOverlayMode())); rbDarken = new QRadioButton(tr("Darken"), modesGroup); connect(rbDarken, SIGNAL(clicked()), view, SLOT(setDarkenMode())); rbLighten = new QRadioButton(tr("Lighten"), modesGroup); connect(rbLighten, SIGNAL(clicked()), view, SLOT(setLightenMode())); rbColorDodge = new QRadioButton(tr("Color Dodge"), modesGroup); connect(rbColorDodge, SIGNAL(clicked()), view, SLOT(setColorDodgeMode())); rbColorBurn = new QRadioButton(tr("Color Burn"), modesGroup); connect(rbColorBurn, SIGNAL(clicked()), view, SLOT(setColorBurnMode())); rbHardLight = new QRadioButton(tr("Hard Light"), modesGroup); connect(rbHardLight, SIGNAL(clicked()), view, SLOT(setHardLightMode())); rbSoftLight = new QRadioButton(tr("Soft Light"), modesGroup); connect(rbSoftLight, SIGNAL(clicked()), view, SLOT(setSoftLightMode())); rbDifference = new QRadioButton(tr("Difference"), modesGroup); connect(rbDifference, SIGNAL(clicked()), view, SLOT(setDifferenceMode())); rbExclusion = new QRadioButton(tr("Exclusion"), modesGroup); connect(rbExclusion, SIGNAL(clicked()), view, SLOT(setExclusionMode())); QGroupBox *circleColorGroup = new QGroupBox(mainGroup); circleColorGroup->setTitle(tr("Circle color")); QSlider *circleColorSlider = new QSlider(Qt::Horizontal, circleColorGroup); circleColorSlider->setRange(0, 359); circleColorSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); connect(circleColorSlider, SIGNAL(valueChanged(int)), view, SLOT(setCircleColor(int))); QGroupBox *circleAlphaGroup = new QGroupBox(mainGroup); circleAlphaGroup->setTitle(tr("Circle alpha")); QSlider *circleAlphaSlider = new QSlider(Qt::Horizontal, circleAlphaGroup); circleAlphaSlider->setRange(0, 255); circleAlphaSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); connect(circleAlphaSlider, SIGNAL(valueChanged(int)), view, SLOT(setCircleAlpha(int))); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #if defined(QT_OPENGL_SUPPORT) && !defined(QT_OPENGL_ES) QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(view->usesOpenGL()); if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); QPushButton *animateButton = new QPushButton(mainGroup); animateButton->setText(tr("Animated")); animateButton->setCheckable(true); animateButton->setChecked(true); QHBoxLayout *viewLayout = new QHBoxLayout(this); viewLayout->addWidget(view); viewLayout->addWidget(mainGroup); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->addWidget(circleColorGroup); mainGroupLayout->addWidget(circleAlphaGroup); mainGroupLayout->addWidget(modesGroup); mainGroupLayout->addStretch(); mainGroupLayout->addWidget(animateButton); mainGroupLayout->addWidget(whatsThisButton); mainGroupLayout->addWidget(showSourceButton); #if defined(QT_OPENGL_SUPPORT) && !defined(QT_OPENGL_ES) mainGroupLayout->addWidget(enableOpenGLButton); #endif QGridLayout *modesLayout = new QGridLayout(modesGroup); modesLayout->addWidget(rbClear, 0, 0); modesLayout->addWidget(rbSource, 1, 0); modesLayout->addWidget(rbDest, 2, 0); modesLayout->addWidget(rbSourceOver, 3, 0); modesLayout->addWidget(rbDestOver, 4, 0); modesLayout->addWidget(rbSourceIn, 5, 0); modesLayout->addWidget(rbDestIn, 6, 0); modesLayout->addWidget(rbSourceOut, 7, 0); modesLayout->addWidget(rbDestOut, 8, 0); modesLayout->addWidget(rbSourceAtop, 9, 0); modesLayout->addWidget(rbDestAtop, 10, 0); modesLayout->addWidget(rbXor, 11, 0); modesLayout->addWidget(rbPlus, 0, 1); modesLayout->addWidget(rbMultiply, 1, 1); modesLayout->addWidget(rbScreen, 2, 1); modesLayout->addWidget(rbOverlay, 3, 1); modesLayout->addWidget(rbDarken, 4, 1); modesLayout->addWidget(rbLighten, 5, 1); modesLayout->addWidget(rbColorDodge, 6, 1); modesLayout->addWidget(rbColorBurn, 7, 1); modesLayout->addWidget(rbHardLight, 8, 1); modesLayout->addWidget(rbSoftLight, 9, 1); modesLayout->addWidget(rbDifference, 10, 1); modesLayout->addWidget(rbExclusion, 11, 1); QVBoxLayout *circleColorLayout = new QVBoxLayout(circleColorGroup); circleColorLayout->addWidget(circleColorSlider); QVBoxLayout *circleAlphaLayout = new QVBoxLayout(circleAlphaGroup); circleAlphaLayout->addWidget(circleAlphaSlider); view->loadDescription(":res/composition/composition.html"); view->loadSourceFile(":res/composition/composition.cpp"); connect(whatsThisButton, SIGNAL(clicked(bool)), view, SLOT(setDescriptionEnabled(bool))); connect(view, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); connect(showSourceButton, SIGNAL(clicked()), view, SLOT(showSource())); #if defined(QT_OPENGL_SUPPORT) && !defined(QT_OPENGL_ES) connect(enableOpenGLButton, SIGNAL(clicked(bool)), view, SLOT(enableOpenGL(bool))); #endif connect(animateButton, SIGNAL(toggled(bool)), view, SLOT(setAnimationEnabled(bool))); circleColorSlider->setValue(270); circleAlphaSlider->setValue(200); rbSourceOut->animateClick(); setWindowTitle(tr("Composition Modes")); }
void PathStrokeControls::layoutForDesktop() { QGroupBox *mainGroup = new QGroupBox(this); mainGroup->setFixedWidth(180); mainGroup->setTitle(tr("Path Stroking")); createCommonControls(mainGroup); QGroupBox* penWidthGroup = new QGroupBox(mainGroup); QSlider *penWidth = new QSlider(Qt::Horizontal, penWidthGroup); penWidth->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); penWidthGroup->setTitle(tr("Pen Width")); penWidth->setRange(0, 500); QPushButton *animated = new QPushButton(mainGroup); animated->setText(tr("Animate")); animated->setCheckable(true); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); // Layouts: QVBoxLayout *penWidthLayout = new QVBoxLayout(penWidthGroup); penWidthLayout->addWidget(penWidth); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->setMargin(0); mainLayout->addWidget(mainGroup); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->setMargin(3); mainGroupLayout->addWidget(m_capGroup); mainGroupLayout->addWidget(m_joinGroup); mainGroupLayout->addWidget(m_styleGroup); mainGroupLayout->addWidget(penWidthGroup); mainGroupLayout->addWidget(m_pathModeGroup); mainGroupLayout->addWidget(animated); mainGroupLayout->addStretch(1); mainGroupLayout->addWidget(showSourceButton); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton); #endif mainGroupLayout->addWidget(whatsThisButton); // Set up connections connect(animated, SIGNAL(toggled(bool)), m_renderer, SLOT(setAnimation(bool))); connect(penWidth, SIGNAL(valueChanged(int)), m_renderer, SLOT(setPenWidth(int))); connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); // Set the defaults animated->setChecked(true); penWidth->setValue(50); }
void PathStrokeControls::layoutForSmallScreens() { createCommonControls(this); m_capGroup->layout()->setMargin(0); m_joinGroup->layout()->setMargin(0); m_styleGroup->layout()->setMargin(0); m_pathModeGroup->layout()->setMargin(0); QPushButton* okBtn = new QPushButton(tr("OK"), this); okBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); okBtn->setMinimumSize(100,okBtn->minimumSize().height()); QPushButton* quitBtn = new QPushButton(tr("Quit"), this); quitBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); quitBtn->setMinimumSize(100, okBtn->minimumSize().height()); QLabel *penWidthLabel = new QLabel(tr(" Width:")); QSlider *penWidth = new QSlider(Qt::Horizontal, this); penWidth->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); penWidth->setRange(0, 500); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(this); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif // Layouts: QHBoxLayout *penWidthLayout = new QHBoxLayout(0); penWidthLayout->addWidget(penWidthLabel, 0, Qt::AlignRight); penWidthLayout->addWidget(penWidth); QVBoxLayout *leftLayout = new QVBoxLayout(0); leftLayout->addWidget(m_capGroup); leftLayout->addWidget(m_joinGroup); #ifdef QT_OPENGL_SUPPORT leftLayout->addWidget(enableOpenGLButton); #endif leftLayout->addLayout(penWidthLayout); QVBoxLayout *rightLayout = new QVBoxLayout(0); rightLayout->addWidget(m_styleGroup); rightLayout->addWidget(m_pathModeGroup); QGridLayout *mainLayout = new QGridLayout(this); mainLayout->setMargin(0); // Add spacers around the form items so we don't look stupid at higher resolutions mainLayout->addItem(new QSpacerItem(0,0), 0, 0, 1, 4); mainLayout->addItem(new QSpacerItem(0,0), 1, 0, 2, 1); mainLayout->addItem(new QSpacerItem(0,0), 1, 3, 2, 1); mainLayout->addItem(new QSpacerItem(0,0), 3, 0, 1, 4); mainLayout->addLayout(leftLayout, 1, 1); mainLayout->addLayout(rightLayout, 1, 2); mainLayout->addWidget(quitBtn, 2, 1, Qt::AlignHCenter | Qt::AlignTop); mainLayout->addWidget(okBtn, 2, 2, Qt::AlignHCenter | Qt::AlignTop); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif connect(penWidth, SIGNAL(valueChanged(int)), m_renderer, SLOT(setPenWidth(int))); connect(quitBtn, SIGNAL(clicked()), this, SLOT(emitQuitSignal())); connect(okBtn, SIGNAL(clicked()), this, SLOT(emitOkSignal())); m_renderer->setAnimation(true); penWidth->setValue(50); }
RepairerDialog::RepairerDialog(qReal::Repairer *repairer, QString const savePath) { mRepairer = repairer; mSavePath = savePath; layout = new QGridLayout(); mPatchSaveDialog = new PatchSaveDialog(savePath, "", mRepairer); mPatchSaveDialog->setMaximumSize(0,0); mPatchSaveDialog->setMaximumSize(maximumWidth(),maximumHeight()); mAutorepairDialog = new QWidget(); mAutorepairLayout = new QGridLayout(); mAutorepairText = new QLabel(tr("QReal will use logs maded during working with editor.")); //todo: autodetect mAutorepairLayout->addWidget(mAutorepairText,0,0,1,-1,Qt::AlignCenter); mAutorepairDialog->setLayout(mAutorepairLayout); mGenerateEditorDialog = new QWidget(); mGenerateEditorLayout = new QGridLayout(); mGenerateEditorText = new QLabel(tr("Choose path to editor XML")); mGenerateEditorPath = new QLineEdit(); mGenerateEditorPathError = new QLabel(tr("Path is incorrect")); mGenerateEditorPathCaption = new QLabel(tr("Path to XML: ")); mGenerateEditorPathBrowse = new QPushButton(tr("Browse")); mGenerateEditorLayout->addWidget(mGenerateEditorText,0,0,1,-1,Qt::AlignLeft); mGenerateEditorLayout->addWidget(mGenerateEditorPathCaption,1,0); mGenerateEditorLayout->addWidget(mGenerateEditorPath,1,1); mGenerateEditorLayout->addWidget(mGenerateEditorPathBrowse,1,2); mGenerateEditorLayout->addWidget(mGenerateEditorPathError,2,1,1,-1,Qt::AlignLeft); mGenerateEditorPathError->setStyleSheet("QLabel {color : red; }"); mGenerateEditorPathError->hide(); mGenerateEditorDialog->setLayout(mGenerateEditorLayout); mPatchSaveSwitcher = new QCheckBox(tr("Patch save")); mAutorepairSwitcher = new QCheckBox(tr("Try to repair save automatically")); mGenerateEditorSwitcher = new QCheckBox(tr("Generate new editor from file")); mCommonText = new QLabel(tr("Current save cannot be loaded.\nChoose ways to fix it:")); mRunButton = new QPushButton(tr("Run")); layout->addWidget(mCommonText,0,0,1,-1,Qt::AlignLeft); layout->addWidget(mPatchSaveSwitcher,1,0,1,-1,Qt::AlignLeft); layout->addWidget(mPatchSaveDialog,2,0); layout->addWidget(mAutorepairSwitcher,3,0,1,-1,Qt::AlignLeft); layout->addWidget(mAutorepairDialog,4,0); layout->addWidget(mGenerateEditorSwitcher,5,0,1,-1,Qt::AlignLeft); layout->addWidget(mGenerateEditorDialog,6,0); layout->addWidget(mRunButton,7,0,1,-1,Qt::AlignCenter); setLayout(layout); mPatchSaveDialog->hide(); mAutorepairDialog->hide(); mGenerateEditorDialog->hide(); QPushButton* patchSaveRunButton = mPatchSaveDialog->getRunButton(); patchSaveRunButton->hide(); connect(mRunButton, SIGNAL(clicked()),this,SLOT(run())); connect(mGenerateEditorPathBrowse, SIGNAL(clicked()),this,SLOT(openEditorXML())); connect(mGenerateEditorPath, SIGNAL(editingFinished()), this, SLOT(checkEditorPath())); connectSwitchers(); int width = this->width() + 20; setFixedSize(width,heightForWidth(width)); mAutorepairSwitcher->toggle(); }
KoResourceItemChooser::KoResourceItemChooser(QSharedPointer<KoAbstractResourceServerAdapter> resourceAdapter, QWidget *parent ) : QWidget( parent ), d( new Private() ) { Q_ASSERT(resourceAdapter); d->splitter = new QSplitter(this); d->model = new KoResourceModel(resourceAdapter, this); d->view = new KoResourceItemView(this); d->view->setModel(d->model); d->view->setItemDelegate( new KoResourceItemDelegate( this ) ); d->view->setSelectionMode( QAbstractItemView::SingleSelection ); d->view->viewport()->installEventFilter(this); connect(d->view, SIGNAL(currentResourceChanged(QModelIndex)), this, SLOT(activated(QModelIndex))); connect (d->view, SIGNAL(contextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); d->previewScroller = new QScrollArea(this); d->previewScroller->setWidgetResizable(true); d->previewScroller->setBackgroundRole(QPalette::Dark); d->previewScroller->setVisible(false); d->previewScroller->setAlignment(Qt::AlignCenter); d->previewLabel = new QLabel(this); d->previewScroller->setWidget(d->previewLabel); d->splitter->addWidget(d->view); d->splitter->addWidget(d->previewScroller); d->splitter->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); connect(d->splitter, SIGNAL(splitterMoved(int,int)), SIGNAL(splitterMoved())); d->buttonGroup = new QButtonGroup(this); d->buttonGroup->setExclusive(false); QGridLayout* layout = new QGridLayout(this); QGridLayout* buttonLayout = new QGridLayout; QPushButton *button = new QPushButton(this); button->setIcon(koIcon("document-open")); button->setToolTip(i18nc("@info:tooltip", "Import resource")); button->setEnabled(true); d->buttonGroup->addButton(button, Button_Import); buttonLayout->addWidget(button, 0, 0); button = new QPushButton(this); button->setIcon(koIcon("trash-empty")); button->setToolTip(i18nc("@info:tooltip", "Delete resource")); button->setEnabled(false); d->buttonGroup->addButton(button, Button_Remove); buttonLayout->addWidget(button, 0, 1); button = new QPushButton(this); button->setIcon(koIcon("download")); button->setToolTip(i18nc("@info:tooltip", "Download resource")); button->setEnabled(true); button->hide(); d->buttonGroup->addButton(button, Button_GhnsDownload); buttonLayout->addWidget(button, 0, 3); button = new QPushButton(this); button->setIcon(koIcon("go-up")); button->setToolTip(i18nc("@info:tooltip", "Share Resource")); button->setEnabled(false); button->hide(); d->buttonGroup->addButton( button, Button_GhnsUpload); buttonLayout->addWidget(button, 0, 4); connect( d->buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotButtonClicked(int))); buttonLayout->setColumnStretch(0, 1); buttonLayout->setColumnStretch(1, 1); buttonLayout->setColumnStretch(2, 2); buttonLayout->setSpacing(0); buttonLayout->setMargin(0); d->viewModeButton = new QToolButton(this); d->viewModeButton->setIcon(koIcon("view-choose")); d->viewModeButton->setPopupMode(QToolButton::InstantPopup); d->viewModeButton->setVisible(false); d->tagManager = new KoResourceTaggingManager(d->model, this); layout->addWidget(d->tagManager->tagChooserWidget(), 0, 0); layout->addWidget(d->viewModeButton, 0, 1); layout->addWidget(d->splitter, 1, 0, 1, 2); layout->addWidget(d->tagManager->tagFilterWidget(), 2, 0, 1, 2); layout->addLayout(buttonLayout, 3, 0, 1, 2); layout->setMargin(0); layout->setSpacing(0); updateButtonState(); showTaggingBar(false,false); activated(d->model->index(0, 0)); }
void PathDeformControls::layoutForDesktop() { QGroupBox* mainGroup = new QGroupBox(this); mainGroup->setTitle(tr("Controls")); QGroupBox *radiusGroup = new QGroupBox(mainGroup); radiusGroup->setTitle(tr("Lens Radius")); QSlider *radiusSlider = new QSlider(Qt::Horizontal, radiusGroup); radiusSlider->setRange(15, 150); radiusSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *deformGroup = new QGroupBox(mainGroup); deformGroup->setTitle(tr("Deformation")); QSlider *deformSlider = new QSlider(Qt::Horizontal, deformGroup); deformSlider->setRange(-100, 100); deformSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *fontSizeGroup = new QGroupBox(mainGroup); fontSizeGroup->setTitle(tr("Font Size")); QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, fontSizeGroup); fontSizeSlider->setRange(16, 200); fontSizeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *textGroup = new QGroupBox(mainGroup); textGroup->setTitle(tr("Text")); QLineEdit *textInput = new QLineEdit(textGroup); QPushButton *animateButton = new QPushButton(mainGroup); animateButton->setText(tr("Animated")); animateButton->setCheckable(true); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); mainGroup->setFixedWidth(180); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->addWidget(radiusGroup); mainGroupLayout->addWidget(deformGroup); mainGroupLayout->addWidget(fontSizeGroup); mainGroupLayout->addWidget(textGroup); mainGroupLayout->addWidget(animateButton); mainGroupLayout->addStretch(1); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton); #endif mainGroupLayout->addWidget(showSourceButton); mainGroupLayout->addWidget(whatsThisButton); QVBoxLayout *radiusGroupLayout = new QVBoxLayout(radiusGroup); radiusGroupLayout->addWidget(radiusSlider); QVBoxLayout *deformGroupLayout = new QVBoxLayout(deformGroup); deformGroupLayout->addWidget(deformSlider); QVBoxLayout *fontSizeGroupLayout = new QVBoxLayout(fontSizeGroup); fontSizeGroupLayout->addWidget(fontSizeSlider); QVBoxLayout *textGroupLayout = new QVBoxLayout(textGroup); textGroupLayout->addWidget(textInput); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->addWidget(mainGroup); mainLayout->setMargin(0); connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int))); connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int))); connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int))); connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool))); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif connect(textInput, SIGNAL(textChanged(QString)), m_renderer, SLOT(setText(QString))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); animateButton->animateClick(); deformSlider->setValue(80); fontSizeSlider->setValue(120); radiusSlider->setValue(100); textInput->setText(tr("Qt")); }
void PathDeformControls::layoutForSmallScreen() { QGroupBox* mainGroup = new QGroupBox(this); mainGroup->setTitle(tr("Controls")); QLabel *radiusLabel = new QLabel(mainGroup); radiusLabel->setText(tr("Lens Radius:")); QSlider *radiusSlider = new QSlider(Qt::Horizontal, mainGroup); radiusSlider->setRange(15, 150); radiusSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QLabel *deformLabel = new QLabel(mainGroup); deformLabel->setText(tr("Deformation:")); QSlider *deformSlider = new QSlider(Qt::Horizontal, mainGroup); deformSlider->setRange(-100, 100); deformSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QLabel *fontSizeLabel = new QLabel(mainGroup); fontSizeLabel->setText(tr("Font Size:")); QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, mainGroup); fontSizeSlider->setRange(16, 200); fontSizeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QPushButton *animateButton = new QPushButton(tr("Animated"), mainGroup); animateButton->setCheckable(true); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(mainGroup); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *quitButton = new QPushButton(tr("Quit"), mainGroup); QPushButton *okButton = new QPushButton(tr("OK"), mainGroup); QGridLayout *mainGroupLayout = new QGridLayout(mainGroup); mainGroupLayout->setMargin(0); mainGroupLayout->addWidget(radiusLabel, 0, 0, Qt::AlignRight); mainGroupLayout->addWidget(radiusSlider, 0, 1); mainGroupLayout->addWidget(deformLabel, 1, 0, Qt::AlignRight); mainGroupLayout->addWidget(deformSlider, 1, 1); mainGroupLayout->addWidget(fontSizeLabel, 2, 0, Qt::AlignRight); mainGroupLayout->addWidget(fontSizeSlider, 2, 1); mainGroupLayout->addWidget(animateButton, 3,0, 1,2); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton, 4,0, 1,2); #endif QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(mainGroup); mainLayout->addStretch(1); mainLayout->addWidget(okButton); mainLayout->addWidget(quitButton); connect(quitButton, SIGNAL(clicked()), this, SLOT(emitQuitSignal())); connect(okButton, SIGNAL(clicked()), this, SLOT(emitOkSignal())); connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int))); connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int))); connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int))); connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool))); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif animateButton->animateClick(); deformSlider->setValue(80); fontSizeSlider->setValue(120); QRect screen_size = QApplication::desktop()->screenGeometry(); radiusSlider->setValue(qMin(screen_size.width(), screen_size.height())/5); m_renderer->setText(tr("Qt")); }
/** \ingroup creditcards \class configureCC \brief This is the master setup window for configuring the credit card subsystem. */ configureCC::configureCC(QWidget* parent, const char* name, bool /*modal*/, Qt::WFlags fl) : XAbstractConfigure(parent, fl) { setupUi(this); if (name) setObjectName(name); connect(_ccCompany, SIGNAL(currentIndexChanged(int)), this, SLOT(sCCCompanyChanged(int))); _enableChargePreauth->setVisible(false); _enableCredit->setVisible(false); // these ids must match the pages in the stack widget _ccCompany->append(0, "Authorize.Net", "AN"); _ccCompany->append(1, "YourPay", "YP"); _ccCompany->append(2, "CyberSource", "CS"); _ccCompany->append(3, "External", "EXT"); if (_metrics->boolean("CCEnablePaymentech")) _ccCompany->append(4, "Paymentech", "PT"); ConfigAuthorizeDotNetProcessor *an = new ConfigAuthorizeDotNetProcessor(this); _configcclist.append(an); _ccWidgetStack->insertWidget(_ccWidgetStack->indexOf(_yourPayStack), an); ConfigCyberSourceProcessor *cs = new ConfigCyberSourceProcessor(this); _configcclist.append(cs); _ccWidgetStack->insertWidget(_ccWidgetStack->indexOf(_externalStack), cs); _ccAccept->setChecked(_metrics->boolean("CCAccept")); _ccTest->setChecked(_metrics->boolean("CCTest")); _ccValidDays->setValue(_metrics->value("CCValidDays").toInt()); _ccCompany->setCurrentIndex(_ccCompany->findText(_metrics->value("CCCompany"))); _ccWidgetStack->setCurrentIndex(_ccCompany->currentIndex()); sCCCompanyChanged(_ccCompany->currentIndex()); _ccServer->setText(_metrics->value("CCServer")); _ccPort->setText(_metrics->value("CCPort")); _ccUseProxyServer->setChecked(_metrics->boolean("CCUseProxyServer")); _ccProxyServer->setText(_metrics->value("CCProxyServer")); _ccProxyPort->setText(_metrics->value("CCProxyPort")); XSqlQuery ccbankq("SELECT * FROM ccbank;"); ccbankq.exec(); while (ccbankq.next()) { if (ccbankq.value("ccbank_ccard_type").toString() == "A") _amexBank->setId(ccbankq.value("ccbank_bankaccnt_id").toInt()); else if (ccbankq.value("ccbank_ccard_type").toString() == "D") _discoverBank->setId(ccbankq.value("ccbank_bankaccnt_id").toInt()); else if (ccbankq.value("ccbank_ccard_type").toString() == "M") _mastercardBank->setId(ccbankq.value("ccbank_bankaccnt_id").toInt()); /* TODO: wait until we support paypal? else if (ccbankq.value("ccbank_ccard_type").toString() == "P") _paypalBank->setId(ccbankq.value("ccbank_bankaccnt_id").toInt()); */ else if (ccbankq.value("ccbank_ccard_type").toString() == "V") _visaBank->setId(ccbankq.value("ccbank_bankaccnt_id").toInt()); } if (ccbankq.lastError().type() != QSqlError::NoError) systemError(this, ccbankq.lastError().text(), __FILE__, __LINE__); _ccYPWinPathPEM->setText(_metrics->value("CCYPWinPathPEM")); _ccYPLinPathPEM->setText(_metrics->value("CCYPLinPathPEM")); _ccYPMacPathPEM->setText(_metrics->value("CCYPMacPathPEM")); _ccYPLinkShield->setChecked(_metrics->boolean("CCYPLinkShield")); _ccYPLinkShieldMax->setValue(_metrics->value("CCYPLinkShieldMax").toInt()); _confirmPreauth->setChecked(_metrics->boolean("CCConfirmPreauth")); _confirmCharge->setChecked(_metrics->boolean("CCConfirmCharge")); _confirmChargePreauth->setChecked(_metrics->boolean("CCConfirmChargePreauth")); _confirmCredit->setChecked(_metrics->boolean("CCConfirmCredit")); _enablePreauth->setChecked(_metrics->boolean("CCEnablePreauth")); _enableCharge->setChecked(_metrics->boolean("CCEnableCharge")); _enableChargePreauth->setChecked(_metrics->boolean("CCEnableChargePreauth")); _enableCredit->setChecked(_metrics->boolean("CCEnableCredit")); _printReceipt->setChecked(_metrics->boolean("CCPrintReceipt")); _cvvRequired->setChecked(_metrics->boolean("CCRequireCVV")); QString str = _metrics->value("CCCVVCheck"); if (str == "F") _cvvReject->setChecked(true); else if (str == "W") _cvvWarn->setChecked(true); else // if (str == "X") _cvvNone->setChecked(true); str = _metrics->value("CCCVVErrors"); _cvvNotMatch->setChecked(str.contains("N")); _cvvNotProcessed->setChecked(str.contains("P")); _cvvNotOnCard->setChecked(str.contains("S")); _cvvInvalidIssuer->setChecked(str.contains("U")); str = _metrics->value("CCAvsCheck"); if (str == "F") _avsReject->setChecked(true); else if (str == "W") _avsWarn->setChecked(true); else // if (str == "X") _avsNone->setChecked(true); str = _metrics->value("CCAvsAddr"); _avsAddrNotMatch->setChecked(str.contains("N")); _avsAddrNotAvail->setChecked(str.contains("X")); str = _metrics->value("CCAvsZIP"); _avsZIPNotMatch->setChecked(str.contains("N")); _avsZIPNotAvail->setChecked(str.contains("X")); str = _metrics->value("CCTestResult"); if (str == "F") _testsAllFail->setChecked(true); else if (str == "S") _testsSomeFail->setChecked(true); else // if (str == "P") _testsAllPass->setChecked(true); if (0 != _metricsenc) { _ccLogin->setText(_metricsenc->value("CCLogin")); _ccPassword->setText(_metricsenc->value("CCPassword")); _ccProxyLogin->setText(_metricsenc->value("CCProxyLogin")); _ccProxyPassword->setText(_metricsenc->value("CCProxyPassword")); _ccYPStoreNum->setText(_metricsenc->value("CCYPStoreNum")); _ccPTDivisionNumber->setText(_metricsenc->value("CCPTDivisionNumber")); } else { _ccLogin->setEnabled(false); _ccPassword->setEnabled(false); _ccProxyLogin->setEnabled(false); _ccProxyPassword->setEnabled(false); _ccYPStoreNum->setEnabled(false); _ccPTDivisionNumber->setEnabled(false); } XAbstractConfigure *encryption = new configureEncryption(this); if (encryption) { encryption->setObjectName("_encryption"); _keyPage->layout()->addWidget(encryption); QPushButton *encbutton = encryption->findChild<QPushButton*>("_save"); if (encbutton) encbutton->hide(); encbutton = encryption->findChild<QPushButton*>("_close"); if (encbutton) encbutton->hide(); encryption->show(); } else if (_metricsenc == 0 && !shownEncryptedMsg) { QMessageBox::critical( this, tr("Cannot Read Configuration"), tr("<p>Cannot read encrypted information from database.")); shownEncryptedMsg = true; } }
GradientWidget::GradientWidget(QWidget *parent) : QWidget(parent) { setWindowTitle(tr("Gradients")); m_renderer = new GradientRenderer(this); QGroupBox *mainGroup = new QGroupBox(this); mainGroup->setTitle(tr("Gradients")); QGroupBox *editorGroup = new QGroupBox(mainGroup); editorGroup->setTitle(tr("Color Editor")); m_editor = new GradientEditor(editorGroup); QGroupBox *typeGroup = new QGroupBox(mainGroup); typeGroup->setTitle(tr("Gradient Type")); m_linearButton = new QRadioButton(tr("Linear Gradient"), typeGroup); m_radialButton = new QRadioButton(tr("Radial Gradient"), typeGroup); m_conicalButton = new QRadioButton(tr("Conical Gradient"), typeGroup); QGroupBox *spreadGroup = new QGroupBox(mainGroup); spreadGroup->setTitle(tr("Spread Method")); m_padSpreadButton = new QRadioButton(tr("Pad Spread"), spreadGroup); m_reflectSpreadButton = new QRadioButton(tr("Reflect Spread"), spreadGroup); m_repeatSpreadButton = new QRadioButton(tr("Repeat Spread"), spreadGroup); QGroupBox *defaultsGroup = new QGroupBox(mainGroup); defaultsGroup->setTitle(tr("Defaults")); QPushButton *default1Button = new QPushButton(tr("1"), defaultsGroup); QPushButton *default2Button = new QPushButton(tr("2"), defaultsGroup); QPushButton *default3Button = new QPushButton(tr("3"), defaultsGroup); QPushButton *default4Button = new QPushButton(tr("Reset"), editorGroup); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); // Layouts QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->addWidget(m_renderer); mainLayout->addWidget(mainGroup); mainGroup->setFixedWidth(180); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->addWidget(editorGroup); mainGroupLayout->addWidget(typeGroup); mainGroupLayout->addWidget(spreadGroup); mainGroupLayout->addWidget(defaultsGroup); mainGroupLayout->addStretch(1); mainGroupLayout->addWidget(showSourceButton); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton); #endif mainGroupLayout->addWidget(whatsThisButton); QVBoxLayout *editorGroupLayout = new QVBoxLayout(editorGroup); editorGroupLayout->addWidget(m_editor); QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup); typeGroupLayout->addWidget(m_linearButton); typeGroupLayout->addWidget(m_radialButton); typeGroupLayout->addWidget(m_conicalButton); QVBoxLayout *spreadGroupLayout = new QVBoxLayout(spreadGroup); spreadGroupLayout->addWidget(m_padSpreadButton); spreadGroupLayout->addWidget(m_repeatSpreadButton); spreadGroupLayout->addWidget(m_reflectSpreadButton); QHBoxLayout *defaultsGroupLayout = new QHBoxLayout(defaultsGroup); defaultsGroupLayout->addWidget(default1Button); defaultsGroupLayout->addWidget(default2Button); defaultsGroupLayout->addWidget(default3Button); editorGroupLayout->addWidget(default4Button); connect(m_editor, SIGNAL(gradientStopsChanged(QGradientStops)), m_renderer, SLOT(setGradientStops(QGradientStops))); connect(m_linearButton, SIGNAL(clicked()), m_renderer, SLOT(setLinearGradient())); connect(m_radialButton, SIGNAL(clicked()), m_renderer, SLOT(setRadialGradient())); connect(m_conicalButton, SIGNAL(clicked()), m_renderer, SLOT(setConicalGradient())); connect(m_padSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setPadSpread())); connect(m_reflectSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setReflectSpread())); connect(m_repeatSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setRepeatSpread())); connect(default1Button, SIGNAL(clicked()), this, SLOT(setDefault1())); connect(default2Button, SIGNAL(clicked()), this, SLOT(setDefault2())); connect(default3Button, SIGNAL(clicked()), this, SLOT(setDefault3())); connect(default4Button, SIGNAL(clicked()), this, SLOT(setDefault4())); connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); #endif connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer->hoverPoints(), SLOT(setDisabled(bool))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), m_renderer->hoverPoints(), SLOT(setDisabled(bool))); m_renderer->loadSourceFile(":res/gradients/gradients.cpp"); m_renderer->loadDescription(":res/gradients/gradients.html"); QTimer::singleShot(50, this, SLOT(setDefault1())); }
XFormWidget::XFormWidget(QWidget *parent) : QWidget(parent), textEditor(new QLineEdit) { setWindowTitle(tr("Affine Transformations")); view = new XFormView(this); view->setMinimumSize(200, 200); QGroupBox *mainGroup = new QGroupBox(this); mainGroup->setFixedWidth(180); mainGroup->setTitle(tr("Affine Transformations")); QGroupBox *rotateGroup = new QGroupBox(mainGroup); rotateGroup->setTitle(tr("Rotate")); QSlider *rotateSlider = new QSlider(Qt::Horizontal, rotateGroup); rotateSlider->setRange(0, 3600); rotateSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *scaleGroup = new QGroupBox(mainGroup); scaleGroup->setTitle(tr("Scale")); QSlider *scaleSlider = new QSlider(Qt::Horizontal, scaleGroup); scaleSlider->setRange(1, 4000); scaleSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *shearGroup = new QGroupBox(mainGroup); shearGroup->setTitle(tr("Shear")); QSlider *shearSlider = new QSlider(Qt::Horizontal, shearGroup); shearSlider->setRange(-990, 990); shearSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QGroupBox *typeGroup = new QGroupBox(mainGroup); typeGroup->setTitle(tr("Type")); QRadioButton *vectorType = new QRadioButton(typeGroup); QRadioButton *pixmapType = new QRadioButton(typeGroup); QRadioButton *textType= new QRadioButton(typeGroup); vectorType->setText(tr("Vector Image")); pixmapType->setText(tr("Pixmap")); textType->setText(tr("Text")); QPushButton *resetButton = new QPushButton(mainGroup); resetButton->setText(tr("Reset Transform")); QPushButton *animateButton = new QPushButton(mainGroup); animateButton->setText(tr("Animate")); animateButton->setCheckable(true); QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); #ifdef QT_OPENGL_SUPPORT QPushButton *enableOpenGLButton = new QPushButton(mainGroup); enableOpenGLButton->setText(tr("Use OpenGL")); enableOpenGLButton->setCheckable(true); enableOpenGLButton->setChecked(view->usesOpenGL()); if (!QGLFormat::hasOpenGL()) enableOpenGLButton->hide(); #endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); QHBoxLayout *viewLayout = new QHBoxLayout(this); viewLayout->addWidget(view); viewLayout->addWidget(mainGroup); QVBoxLayout *rotateGroupLayout = new QVBoxLayout(rotateGroup); rotateGroupLayout->addWidget(rotateSlider); QVBoxLayout *scaleGroupLayout = new QVBoxLayout(scaleGroup); scaleGroupLayout->addWidget(scaleSlider); QVBoxLayout *shearGroupLayout = new QVBoxLayout(shearGroup); shearGroupLayout->addWidget(shearSlider); QVBoxLayout *typeGroupLayout = new QVBoxLayout(typeGroup); typeGroupLayout->addWidget(vectorType); typeGroupLayout->addWidget(pixmapType); typeGroupLayout->addWidget(textType); typeGroupLayout->addSpacing(4); typeGroupLayout->addWidget(textEditor); QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup); mainGroupLayout->addWidget(rotateGroup); mainGroupLayout->addWidget(scaleGroup); mainGroupLayout->addWidget(shearGroup); mainGroupLayout->addWidget(typeGroup); mainGroupLayout->addStretch(1); mainGroupLayout->addWidget(resetButton); mainGroupLayout->addWidget(animateButton); mainGroupLayout->addWidget(showSourceButton); #ifdef QT_OPENGL_SUPPORT mainGroupLayout->addWidget(enableOpenGLButton); #endif mainGroupLayout->addWidget(whatsThisButton); connect(rotateSlider, SIGNAL(valueChanged(int)), view, SLOT(changeRotation(int))); connect(shearSlider, SIGNAL(valueChanged(int)), view, SLOT(changeShear(int))); connect(scaleSlider, SIGNAL(valueChanged(int)), view, SLOT(changeScale(int))); connect(vectorType, SIGNAL(clicked()), view, SLOT(setVectorType())); connect(pixmapType, SIGNAL(clicked()), view, SLOT(setPixmapType())); connect(textType, SIGNAL(clicked()), view, SLOT(setTextType())); connect(textType, SIGNAL(toggled(bool)), textEditor, SLOT(setEnabled(bool))); connect(textEditor, SIGNAL(textChanged(QString)), view, SLOT(setText(QString))); connect(view, SIGNAL(rotationChanged(int)), rotateSlider, SLOT(setValue(int))); connect(view, SIGNAL(scaleChanged(int)), scaleSlider, SLOT(setValue(int))); connect(view, SIGNAL(shearChanged(int)), shearSlider, SLOT(setValue(int))); connect(resetButton, SIGNAL(clicked()), view, SLOT(reset())); connect(animateButton, SIGNAL(clicked(bool)), view, SLOT(setAnimation(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), view, SLOT(setDescriptionEnabled(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), view->hoverPoints(), SLOT(setDisabled(bool))); connect(view, SIGNAL(descriptionEnabledChanged(bool)), view->hoverPoints(), SLOT(setDisabled(bool))); connect(view, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); connect(showSourceButton, SIGNAL(clicked()), view, SLOT(showSource())); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), view, SLOT(enableOpenGL(bool))); #endif view->loadSourceFile(":res/affine/xform.cpp"); view->loadDescription(":res/affine/xform.html"); // defaults view->reset(); vectorType->setChecked(true); textEditor->setText("Qt Affine Transformation Demo"); textEditor->setEnabled(false); animateButton->animateClick(); }
//-------------------------------------------------------------------------------- void QmvQueryWidget::initAdvanced() { query_icons = new QmvIcons( this, "querywidget-icons" ); QmvClass * query_relation = query_object->getRelation(); dialog_advqry = new QDialog( this, "advanced query", TRUE, 0 ); dialog_advqry->setCaption( "Advanced Query - " + query_object->getRelation()->relationTitle() ); QVBoxLayout * vl_advqry = new QVBoxLayout( dialog_advqry, 2 ); QHBoxLayout * hl_advqry = new QHBoxLayout( vl_advqry, 0, "controls_advqry" ); QLabel * testlabel = new QLabel( "Advanced Query - " + query_relation->relationTitle(), dialog_advqry ); hl_advqry->addWidget(testlabel); //------------------------------------------------------------ // Control: close button //------------------------------------------------------------ QPushButton * close_advqry = new QPushButton( "Close the advanced query window", dialog_advqry, "close_advqry"); close_advqry->setPixmap( query_icons->getPixmap( QmvIcons::QuitIcon ) ); close_advqry->setAccel( CTRL+Key_W ); QWhatsThis::add( close_advqry, "<b>Close the advanced query window:</b>."); hl_advqry->addStretch( 10 ); hl_advqry->addWidget(close_advqry); close_advqry->setDefault(FALSE); close_advqry->setFocusPolicy( QWidget::NoFocus ); connect( close_advqry, SIGNAL( clicked() ), dialog_advqry, SLOT( accept() ) ); // dummy button to catch QDialog return key // (return is used to activate the search) QPushButton * dummy = new QPushButton( "", dialog_advqry, ""); dummy->hide(); dummy->setDefault(TRUE); // add stretch between top and header vl_advqry->addStretch(); //--------------------------- // Create Select (GO) button //--------------------------- QHBoxLayout * cond_layout = new QHBoxLayout( vl_advqry, 0, "condition" ); QPushButton * pb_select = createWhereButton( "Find matching rows:", dialog_advqry, "fieldlabel" ); cond_layout->addWidget( pb_select ); pb_select->setDefault(FALSE); pb_select->setFocusPolicy( QWidget::NoFocus );; //------------------------------------------------------------ // Add condition widgets //------------------------------------------------------------ int cond_size = 4; int base_cond_count = query_object->countConditions(); initConditions( dialog_advqry, cond_size); for ( int cond = 0; cond < cond_size; cond++) { QmvQueryConditionWidget * cw = getCondition(cond); cond_layout = new QHBoxLayout( vl_advqry, 0, "condition" ); cond_layout->addWidget( cw ); // only set if a new widget - the base widget may have been altered. // :: query_object->getTitleAt(cond) returns from the original unaltered attribute list. if ( cond >= base_cond_count ) cw->atChanged( query_object->getTitleAt(cond) ); } //------------------------------------------------------------ // Add horizontal layout for header widgets - order,limit,offset //------------------------------------------------------------ QHBoxLayout * hl_header_advqry = new QHBoxLayout( vl_advqry, 0, "limit and offset" ); //------------------------------- // Create combobox for order by //------------------------------- QLabel * lab = new QLabel( "Order by:", dialog_advqry, "orderlabel" ); hl_header_advqry->addWidget( lab ); createOrderByComboBox( dialog_advqry, "value_combo"); hl_header_advqry->addWidget( cb_order_list); //------------------------------- // Add limit selector //------------------------------- lab = new QLabel( "Row Limit:", dialog_advqry, "limitlabel" ); hl_header_advqry->addWidget( lab ); sb_query_limit = new QSpinBox ( 0, 1000, 10, dialog_advqry, "querylimit" ); hl_header_advqry->addWidget( sb_query_limit ); sb_query_limit->setSpecialValueText( "none" ); sb_query_limit->setValue( query_object->getLimit() ); connect( sb_query_limit, SIGNAL( valueChanged( int ) ), query_object, SLOT( setLimit( int ) ) ); //---------------------- // Add offset selector //---------------------- lab = new QLabel( "Offset:", dialog_advqry, "offsetlabel" ); hl_header_advqry->addWidget( lab ); sb_query_offset = new QSpinBox ( 0, 1000, 10, dialog_advqry, "queryoffset" ); hl_header_advqry->addWidget( sb_query_offset ); sb_query_offset->setValue( query_object->getOffset() ); connect( sb_query_offset, SIGNAL( valueChanged( int ) ), query_object, SLOT( setOffset( int ) ) ); getCondition(0)->setFocus(); }
void JumpButtonBar::updateButtons() { int currentButton = mGroupBox->selectedId(); // the easiest way to remove all buttons ;) mButtons.setAutoDelete( true ); mButtons.clear(); mButtons.setAutoDelete( false ); QStringList characters; // calculate how many buttons are possible QFontMetrics fm = fontMetrics(); QPushButton *btn = new QPushButton( "", this ); btn->hide(); QSize buttonSize = style().sizeFromContents( QStyle::CT_PushButton, btn, fm.size( ShowPrefix, "X - X") ). expandedTo( QApplication::globalStrut() ); delete btn; int buttonHeight = buttonSize.height() + 8; uint possibleButtons = (height() / buttonHeight) - 1; QString character; KABC::AddressBook *ab = mCore->addressBook(); KABC::AddressBook::Iterator it; for ( it = ab->begin(); it != ab->end(); ++it ) { KABC::Field *field = 0; field = mCore->currentSortField(); if ( field ) { setEnabled( true ); if ( !field->value( *it ).isEmpty() ) character = field->value( *it )[ 0 ].lower(); } else { setEnabled( false ); return; } if ( !character.isEmpty() && !characters.contains( character ) ) characters.append( character ); } sortListLocaleAware( characters ); if ( characters.count() <= possibleButtons ) { // at first the easy case: all buttons fits in window for ( uint i = 0; i < characters.count(); ++i ) { JumpButton *button = new JumpButton( characters[ i ], QString::null, mGroupBox ); connect( button, SIGNAL( clicked() ), this, SLOT( letterClicked() ) ); mButtons.append( button ); button->show(); } } else { if ( possibleButtons == 0 ) // to avoid crashes on startup return; int offset = characters.count() / possibleButtons; int odd = characters.count() % possibleButtons; if ( odd ) offset++; int current = 0; for ( uint i = 0; i < possibleButtons; ++i ) { if ( characters.count() - current == 0 ) continue; if ( characters.count() - current <= possibleButtons - i ) { JumpButton *button = new JumpButton( characters[ current ], QString::null, mGroupBox ); connect( button, SIGNAL( clicked() ), this, SLOT( letterClicked() ) ); mButtons.append( button ); button->show(); current++; } else { int pos = ( current + offset >= (int)characters.count() ? characters.count() - 1 : current + offset - 1 ); QString range; for ( int j = current; j < pos + 1; ++j ) range.append( characters[ j ] ); JumpButton *button = new JumpButton( characters[ current ], characters[ pos ], mGroupBox ); connect( button, SIGNAL( clicked() ), this, SLOT( letterClicked() ) ); mButtons.append( button ); button->show(); current = ( i + 1 ) * offset; } } } if ( currentButton != -1 ) mGroupBox->setButton( currentButton ); else mGroupBox->setButton( 0 ); int maxWidth = 0; QPushButton *button; for ( button = mButtons.first(); button; button = mButtons.next() ) maxWidth = QMAX( maxWidth, button->sizeHint().width() ); setFixedWidth( maxWidth ); }