TupCanvas::TupCanvas(QWidget *parent, Qt::WindowFlags flags, TupGraphicsScene *scene, const QPointF centerPoint, const QSize &screenSize, TupProject *project, double scaleFactor, int angle, TupBrushManager *brushManager) : QFrame(parent, flags), k(new Private) { setWindowTitle(tr("Tupi: 2D Magic")); setWindowIcon(QIcon(QPixmap(THEME_DIR + "icons/animation_mode.png"))); k->scene = scene; k->size = project->dimension(); k->currentColor = brushManager->penColor(); k->brushManager = brushManager; k->project = project; graphicsView = new TupCanvasView(this, screenSize, k->size, project->bgColor()); graphicsView->setScene(scene); graphicsView->centerOn(centerPoint); graphicsView->scale(scaleFactor, scaleFactor); graphicsView->rotate(angle); TImageButton *pencil = new TImageButton(QPixmap(THEME_DIR + "icons/pencil_big.png"), 40, this, true); pencil->setToolTip(tr("Pencil")); connect(pencil, SIGNAL(clicked()), this, SLOT(wakeUpPencil())); TImageButton *ink = new TImageButton(QPixmap(THEME_DIR + "icons/ink_big.png"), 40, this, true); ink->setToolTip(tr("Ink")); connect(ink, SIGNAL(clicked()), this, SLOT(wakeUpInk())); /* TImageButton *polyline = new TImageButton(QPixmap(THEME_DIR + "icons/polyline_big.png"), 40, this, true); polyline->setToolTip(tr("Polyline")); connect(polyline, SIGNAL(clicked()), this, SLOT(wakeUpPolyline())); */ TImageButton *ellipse = new TImageButton(QPixmap(THEME_DIR + "icons/ellipse_big.png"), 40, this, true); ellipse->setToolTip(tr("Ellipse")); connect(ellipse, SIGNAL(clicked()), this, SLOT(wakeUpEllipse())); TImageButton *rectangle = new TImageButton(QPixmap(THEME_DIR + "icons/square_big.png"), 40, this, true); rectangle->setToolTip(tr("Rectangle")); connect(rectangle, SIGNAL(clicked()), this, SLOT(wakeUpRectangle())); TImageButton *images = new TImageButton(QPixmap(THEME_DIR + "icons/bitmap_big.png"), 40, this, true); images->setToolTip(tr("Images")); connect(images, SIGNAL(clicked()), this, SLOT(wakeUpLibrary())); TImageButton *objects = new TImageButton(QPixmap(THEME_DIR + "icons/selection_big.png"), 40, this, true); objects->setToolTip(tr("Object Selection")); connect(objects, SIGNAL(clicked()), this, SLOT(wakeUpObjectSelection())); TImageButton *nodes = new TImageButton(QPixmap(THEME_DIR + "icons/nodes_big.png"), 40, this, true); nodes->setToolTip(tr("Nodes Selection")); connect(nodes, SIGNAL(clicked()), this, SLOT(wakeUpNodeSelection())); TImageButton *trash = new TImageButton(QPixmap(THEME_DIR + "icons/delete_big.png"), 40, this, true); trash->setToolTip(tr("Delete Selection")); connect(trash, SIGNAL(clicked()), this, SLOT(wakeUpDeleteSelection())); TImageButton *zoomIn = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_in_big.png"), 40, this, true); zoomIn->setToolTip(tr("Zoom In")); connect(zoomIn, SIGNAL(clicked()), this, SLOT(wakeUpZoomIn())); TImageButton *zoomOut = new TImageButton(QPixmap(THEME_DIR + "icons/zoom_out_big.png"), 40, this, true); zoomOut->setToolTip(tr("Zoom Out")); connect(zoomOut, SIGNAL(clicked()), this, SLOT(wakeUpZoomOut())); TImageButton *shift = new TImageButton(QPixmap(THEME_DIR + "icons/hand_big.png"), 40, this, true); shift->setToolTip(tr("Shift")); connect(shift, SIGNAL(clicked()), this, SLOT(wakeUpShift())); TImageButton *undo = new TImageButton(QPixmap(THEME_DIR + "icons/undo_big.png"), 40, this, true); undo->setToolTip(tr("Undo")); connect(undo, SIGNAL(clicked()), this, SLOT(undo())); TImageButton *redo = new TImageButton(QPixmap(THEME_DIR + "icons/redo_big.png"), 40, this, true); redo->setToolTip(tr("Redo")); connect(redo, SIGNAL(clicked()), this, SLOT(redo())); TImageButton *colors = new TImageButton(QPixmap(THEME_DIR + "icons/color_palette_big.png"), 40, this, true); colors->setToolTip(tr("Color Palette")); connect(colors, SIGNAL(clicked()), this, SLOT(colorDialog())); TImageButton *pen = new TImageButton(QPixmap(THEME_DIR + "icons/pen_properties.png"), 40, this, true); pen->setToolTip(tr("Pen Size")); connect(pen, SIGNAL(clicked()), this, SLOT(penDialog())); TImageButton *exposure = new TImageButton(QPixmap(THEME_DIR + "icons/exposure_sheet_big.png"), 40, this, true); exposure->setToolTip(tr("Exposure Sheet")); connect(exposure, SIGNAL(clicked()), this, SLOT(exposureDialog())); QBoxLayout *controls = new QBoxLayout(QBoxLayout::TopToBottom); controls->setAlignment(Qt::AlignHCenter | Qt::AlignTop); controls->setContentsMargins(3, 3, 3, 3); controls->setSpacing(7); controls->addWidget(pencil); controls->addWidget(ink); // controls->addWidget(polyline); controls->addWidget(ellipse); controls->addWidget(rectangle); controls->addWidget(images); controls->addWidget(objects); controls->addWidget(nodes); controls->addWidget(trash); controls->addWidget(zoomIn); controls->addWidget(zoomOut); controls->addWidget(hand); controls->addWidget(undo); controls->addWidget(redo); controls->addWidget(colors); controls->addWidget(pen); controls->addWidget(exposure); QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(2); layout->addLayout(controls); layout->addWidget(graphicsView); setLayout(layout); }
void ToCluster::constructor() { QGridLayout *_layoutMain = new QGridLayout(this); _layoutMain->setMargin(0); _layoutMain->setSpacing(1); QLabel *_toNumberLit = new QLabel(tr("Transfer Order #:")); _toNumber = new ToLineEdit(this); _list = new QPushButton(tr("...")); QLabel *_srcwhsLit = new QLabel(tr("From:")); _srcwhs = new WComboBox(this, "_srcwhs"); QLabel *_dstwhsLit = new QLabel(tr("To:")); _dstwhs = new WComboBox(this, "_dstwhs"); _layoutMain->addWidget(_toNumberLit, 0, 0); _layoutMain->addWidget(_toNumber, 0, 1, 1, 2); _layoutMain->addWidget(_list, 0, 3); _layoutMain->addWidget(_srcwhsLit, 1, 0); _layoutMain->addWidget(_srcwhs, 1, 1); _layoutMain->addWidget(_dstwhsLit, 1, 2); _layoutMain->addWidget(_dstwhs, 1, 3); _toNumberLit->setObjectName("_toNumberLit"); _toNumberLit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); _toNumberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _toNumber->setObjectName("_toNumber"); _toNumber->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _list->setObjectName("_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifndef Q_WS_MAC _list->setMaximumWidth(25); #endif _list->setFocusPolicy(Qt::NoFocus); _srcwhsLit->setObjectName("_srcwhsLit"); _srcwhsLit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); _srcwhsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _srcwhsLit->setBuddy(_srcwhs); _srcwhs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _srcwhs->setEnabled(false); _dstwhsLit->setObjectName("_dstwhsLit"); _dstwhsLit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); _dstwhsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _dstwhsLit->setBuddy(_dstwhs); _dstwhs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _dstwhs->setEnabled(false); setLayout(_layoutMain); connect(_list, SIGNAL(clicked()), this, SLOT(sList())); connect(_toNumber, SIGNAL(requestList()), SLOT(sList())); connect(_toNumber, SIGNAL(newSrcwhs(const int)), _srcwhs, SLOT(setId(const int))); connect(_toNumber, SIGNAL(newDstwhs(const int)), _dstwhs, SLOT(setId(const int))); connect(_toNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_toNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); setFocusProxy(_toNumber); setFocusPolicy(Qt::StrongFocus); }
AbonentDialog::AbonentDialog(qint32 id, quint8 userId, QWidget *parent) : QDialog(parent), userId_(userId) { clientComboBox = new QComboBox; clientLabel = new QLabel(trUtf8("Клиент")); clientLabel->setBuddy(clientComboBox); abonentEdit = new QLineEdit; abonentLabel = new QLabel(trUtf8("Абонент")); abonentLabel->setBuddy(abonentEdit); telEdit = new QLineEdit; telLabel = new QLabel(trUtf8("Телефон")); telLabel->setBuddy(telEdit); tplanComboBox = new QComboBox; tplanLabel = new QLabel(trUtf8("ТП")); tplanLabel->setBuddy(tplanComboBox); abonPaySpinBox = new QDoubleSpinBox; abonPaySpinBox->setRange(0, 999999999); abonPayLabel = new QLabel(trUtf8("Абон.плата")); abonPayLabel->setBuddy(abonPaySpinBox); operatorComboBox = new QComboBox; operatorLabel = new QLabel(trUtf8("Оператор")); operatorLabel->setBuddy(operatorComboBox); pBalanceSpinBox = new QDoubleSpinBox; pBalanceSpinBox->setRange(0, 999999999); pBalanceLabel = new QLabel(trUtf8("П.баланс")); pBalanceLabel->setBuddy(pBalanceSpinBox); limitSpinBox = new QDoubleSpinBox; limitSpinBox->setRange(0, 999999999); limitLabel = new QLabel(trUtf8("Лимит")); limitLabel->setBuddy(limitSpinBox); typeComboBox = new QComboBox; typeLabel = new QLabel(trUtf8("ТП")); typeLabel->setBuddy(typeComboBox); buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(OkButtonPushed())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); QGridLayout *topLayout = new QGridLayout; topLayout->addWidget(clientLabel, 0, 0); topLayout->addWidget(clientComboBox, 0, 1); topLayout->addWidget(abonentLabel, 1, 0); topLayout->addWidget(abonentEdit, 1, 1); topLayout->addWidget(telLabel, 2, 0); topLayout->addWidget(telEdit, 2, 1); topLayout->addWidget(tplanLabel, 3, 0); topLayout->addWidget(tplanComboBox, 3, 1); topLayout->addWidget(abonPayLabel, 4, 0); topLayout->addWidget(abonPaySpinBox, 4, 1); topLayout->addWidget(pBalanceLabel, 5, 0); topLayout->addWidget(pBalanceSpinBox, 5, 1); topLayout->addWidget(limitLabel, 6, 0); topLayout->addWidget(limitSpinBox, 6, 1); topLayout->addWidget(typeLabel, 7, 0); topLayout->addWidget(typeComboBox, 7, 1); topLayout->addWidget(operatorLabel, 8, 0); topLayout->addWidget(operatorComboBox, 8, 1); tableModel = new QSqlRelationalTableModel(this); tableModel->setTable("tb_abonents"); tableModel->setRelation(Client, QSqlRelation("tb_clients", "uid", "text")); tableModel->setRelation(TPlan, QSqlRelation("tb_tplans", "uid", "text")); tableModel->setRelation(Operator, QSqlRelation("tb_operators", "uid", "text")); tableModel->setRelation(Type, QSqlRelation("tb_abonentTypes", "uid", "text")); tableModel->setFilter(QString("tb_abonents.uid=%1").arg(id)); tableModel->select(); tableModel->setEditStrategy(QSqlTableModel::OnManualSubmit); clientModel = tableModel->relationModel(Client); clientModel->sort(clientModel->fieldIndex("text"), Qt::AscendingOrder); clientComboBox->setModel(clientModel); clientComboBox->setModelColumn(clientModel->fieldIndex("text")); tplanModel = tableModel->relationModel(TPlan); tplanModel->sort(tplanModel->fieldIndex("text"), Qt::AscendingOrder); tplanComboBox->setModel(tplanModel); tplanComboBox->setModelColumn(tplanModel->fieldIndex("text")); connect(tplanComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(tplanChanged()), Qt::UniqueConnection); for(qint32 i=0; i < tplanModel->rowCount(); ++i) { QString text = tplanModel->data(tplanModel->index(i, 1)).toString(); double costR=tplanModel->data(tplanModel->index(i, 2)).toDouble(); hashTplans[text] = costR; } operatorModel = tableModel->relationModel(Operator); operatorModel->sort(operatorModel->fieldIndex("text"), Qt::AscendingOrder); operatorComboBox->setModel(operatorModel); operatorComboBox->setModelColumn(tplanModel->fieldIndex("text")); typeModel = tableModel->relationModel(Type); typeModel->sort(typeModel->fieldIndex("text"), Qt::AscendingOrder); typeComboBox->setModel(typeModel); typeComboBox->setModelColumn(typeModel->fieldIndex("text")); mapper = new QDataWidgetMapper(this); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); mapper->setModel(tableModel); mapper->setItemDelegate(new QSqlRelationalDelegate(this)); mapper->addMapping(clientComboBox, Client); mapper->addMapping(abonentEdit, Abonent); mapper->addMapping(telEdit, TelA); mapper->addMapping(tplanComboBox, TPlan); mapper->addMapping(abonPaySpinBox, AbonPay); mapper->addMapping(pBalanceSpinBox, PBalance); mapper->addMapping(limitSpinBox, Limit); mapper->addMapping(typeComboBox, Type); mapper->addMapping(operatorComboBox, Operator); if(id == -1) { tableModel->insertRow(0); setWindowTitle(trUtf8("Новый абонент")); } else setWindowTitle(trUtf8("Редактирование абонента")); mapper->toFirst(); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topLayout); mainLayout->addWidget(buttonBox); setLayout(mainLayout); }
ProcessingPluginDialog::ProcessingPluginDialog(unsigned dataSourceInputCount, OscilloscopeWindow *parent) : QDialog(parent), channelChooserGroup(this) { mainWindow = parent; inputCount = outputCount = 0; this->dataSourceInputCount = dataSourceInputCount; // layout QGridLayout *mainLayout = new QGridLayout; mainLayout->setColumnMinimumWidth(1, 5); // plugins list mainLayout->addWidget(new QLabel(tr("Available")), 0, 0); pluginsAvailableList = new QListWidget; for (size_t i = 0; i < parent->processingPluginsDescriptions.size(); i++) { pluginsAvailableList->addItem(parent->processingPluginsDescriptions[i]->name()); pluginsAvailableList->item(i)->setToolTip(parent->processingPluginsDescriptions[i]->description()); } QPushButton *addPlugin = new QPushButton(tr("&Use")); // active plugins mainLayout->addWidget(new QLabel(tr("Active")), 0, 2); pluginsActiveTable = new QTableWidget(0, 4); pluginsActiveTable->setSortingEnabled(false); pluginsActiveTable->setDragEnabled(false); pluginsActiveTable->setShowGrid(false); pluginsActiveTable->setEditTriggers(QAbstractItemView::NoEditTriggers); pluginsActiveTable->setSelectionMode(QAbstractItemView::NoSelection); pluginsActiveTable->setContextMenuPolicy(Qt::CustomContextMenu); // max channel number extendedChannelChooser = new QSpinBox(this); extendedChannelChooser->setButtonSymbols(QAbstractSpinBox::PlusMinus); // ok / cancel buttons QPushButton *okButton = new QPushButton(tr("OK")); okButton->setDefault(true); QPushButton *cancelButton = new QPushButton(tr("Cancel")); // connections connect(pluginsAvailableList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), SLOT(useSelectedPlugins(QListWidgetItem *))); connect(addPlugin, SIGNAL(clicked()), SLOT(useSelectedPlugins())); connect(okButton, SIGNAL(clicked()), SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), SLOT(reject())); connect(pluginsActiveTable, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(pluginChannelEdit(const QPoint &))); connect(pluginsActiveTable, SIGNAL(itemClicked(QTableWidgetItem *)), SLOT(pluginEdit(QTableWidgetItem *))); connect(extendedChannelChooser, SIGNAL(valueChanged(int)), SLOT(recreateChannelMenu(int))); // layout QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(1); buttonLayout->addWidget(okButton); buttonLayout->addWidget(cancelButton); QHBoxLayout *maxChannelLayout = new QHBoxLayout; maxChannelLayout->addWidget(new QLabel(tr("Number of extended channel"))); maxChannelLayout->addWidget(extendedChannelChooser); mainLayout->addWidget(pluginsAvailableList, 1, 0); mainLayout->addWidget(addPlugin, 2, 0); mainLayout->setColumnStretch(0, 1); mainLayout->addWidget(pluginsActiveTable, 1, 2); mainLayout->addLayout(maxChannelLayout, 2, 2); mainLayout->setColumnStretch(2, 2); mainLayout->addLayout(buttonLayout, 3, 0, 1, -1); setLayout(mainLayout); setWindowTitle(tr("Plugins configuration")); recomputeUseChannelCount(); recreateChannelMenu(extendedChannelChooser->minimum()); toChangeItem = NULL; }
OAuthDialog::OAuthDialog(Context *context, OAuthSite site, QString baseURL) : context(context), site(site), baseURL(baseURL) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("OAuth")); // check if SSL is available - if not - message and end if (!QSslSocket::supportsSsl()) { QString text = QString(tr("SSL Security Libraries required for 'Authorise' are missing in this installation.")); QMessageBox sslMissing(QMessageBox::Critical, tr("Authorization Error"), text); sslMissing.exec(); noSSLlib = true; return; } // SSL is available - so authorisation can take place noSSLlib = false; layout = new QVBoxLayout(); layout->setSpacing(0); layout->setContentsMargins(2,0,2,2); setLayout(layout); #if defined(NOWEBKIT) || (QT_VERSION > 0x050000 && defined(Q_OS_MAC)) view = new QWebEngineView(); #else view = new QWebView(); #endif view->setContentsMargins(0,0,0,0); view->page()->view()->setContentsMargins(0,0,0,0); view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); view->setAcceptDrops(false); layout->addWidget(view); QString urlstr = ""; if (site == STRAVA) { urlstr = QString("https://www.strava.com/oauth/authorize?"); urlstr.append("client_id=").append(GC_STRAVA_CLIENT_ID).append("&"); urlstr.append("scope=view_private,write&"); urlstr.append("redirect_uri=http://www.goldencheetah.org/&"); urlstr.append("response_type=code&"); urlstr.append("approval_prompt=force"); } else if (site == DROPBOX) { urlstr = QString("https://www.dropbox.com/1/oauth2/authorize?"); #ifdef GC_DROPBOX_CLIENT_ID urlstr.append("client_id=").append(GC_DROPBOX_CLIENT_ID).append("&"); #endif urlstr.append("redirect_uri=https://goldencheetah.github.io/blank.html&"); urlstr.append("response_type=code&"); urlstr.append("force_reapprove=true"); } else if (site == TWITTER) { #ifdef GC_HAVE_KQOAUTH oauthRequest = new KQOAuthRequest; oauthManager = new KQOAuthManager(this); connect(oauthManager, SIGNAL(temporaryTokenReceived(QString,QString)), this, SLOT(onTemporaryTokenReceived(QString, QString))); connect(oauthManager, SIGNAL(authorizationReceived(QString,QString)), this, SLOT( onAuthorizationReceived(QString, QString))); connect(oauthManager, SIGNAL(accessTokenReceived(QString,QString)), this, SLOT(onAccessTokenReceived(QString,QString))); connect(oauthManager, SIGNAL(requestReady(QByteArray)), this, SLOT(onRequestReady(QByteArray))); connect(oauthManager, SIGNAL(authorizationPageRequested(QUrl)), this, SLOT(onAuthorizationPageRequested(QUrl))); oauthRequest->initRequest(KQOAuthRequest::TemporaryCredentials, QUrl("https://api.twitter.com/oauth/request_token")); oauthRequest->setConsumerKey(GC_TWITTER_CONSUMER_KEY); oauthRequest->setConsumerSecretKey(GC_TWITTER_CONSUMER_SECRET); oauthManager->setHandleUserAuthorization(true); oauthManager->setHandleAuthorizationPageOpening(false); oauthManager->executeRequest(oauthRequest); #endif } else if (site == CYCLING_ANALYTICS) { urlstr = QString("https://www.cyclinganalytics.com/api/auth?"); urlstr.append("client_id=").append(GC_CYCLINGANALYTICS_CLIENT_ID).append("&"); urlstr.append("scope=modify_rides&"); urlstr.append("redirect_uri=http://www.goldencheetah.org/&"); urlstr.append("response_type=code&"); urlstr.append("approval_prompt=force"); } else if (site == GOOGLE_CALENDAR) { // OAUTH 2.0 - Google flow for installed applications urlstr = QString("https://accounts.google.com/o/oauth2/auth?"); urlstr.append("scope=https://www.googleapis.com/auth/calendar&"); urlstr.append("redirect_uri=urn:ietf:wg:oauth:2.0:oob&"); urlstr.append("response_type=code&"); urlstr.append("client_id=").append(GC_GOOGLE_CALENDAR_CLIENT_ID); #if QT_VERSION >= 0x050000 } else if (site == GOOGLE_DRIVE) { const QString scope = GoogleDrive::GetScope(context); // OAUTH 2.0 - Google flow for installed applications urlstr = QString("https://accounts.google.com/o/oauth2/auth?"); // We only request access to the application data folder, not all files. urlstr.append("scope=https://www.googleapis.com/auth/" + scope + "&"); urlstr.append("redirect_uri=urn:ietf:wg:oauth:2.0:oob&"); urlstr.append("response_type=code&"); urlstr.append("client_id=").append(GC_GOOGLE_DRIVE_CLIENT_ID); #endif } else if (site == TODAYSPLAN) { //urlstr = QString("https://whats.todaysplan.com.au/en/authorize/"); if (baseURL=="") baseURL="https://whats.todaysplan.com.au"; urlstr = QString("%1/authorize/").arg(baseURL); #ifdef GC_TODAYSPLAN_CLIENT_ID urlstr.append(GC_TODAYSPLAN_CLIENT_ID); #endif } // different process to get the token for STRAVA, CYCLINGANALYTICS vs. // TWITTER if (site == DROPBOX || site == STRAVA || site == CYCLING_ANALYTICS || site == GOOGLE_CALENDAR || site == GOOGLE_DRIVE || site == TODAYSPLAN) { url = QUrl(urlstr); view->setUrl(url); // connects connect(view, SIGNAL(urlChanged(const QUrl&)), this, SLOT(urlChanged(const QUrl&))); connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); }
LatexLogWidget::LatexLogWidget(QWidget *parent) : QWidget(parent), logModel(0), displayPartsActions(0),filterErrorAction(0),filterWarningAction(0),filterBadBoxAction(0),logpresent(false) { logModel = new LatexLogModel(this);//needs loaded line marks errorTable = new QTableView(this); int rowHeight = getOptimalRowHeight(errorTable); errorTable->verticalHeader()->setDefaultSectionSize(rowHeight); QFontMetrics fm(QApplication::font()); errorTable->setSelectionBehavior(QAbstractItemView::SelectRows); errorTable->setSelectionMode(QAbstractItemView::SingleSelection); errorTable->setColumnWidth(0,fm.width("> ")); errorTable->setColumnWidth(1,20*fm.width("w")); errorTable->setColumnWidth(2,fm.width("WarningW")); errorTable->setColumnWidth(3,fm.width("Line WWWWW")); errorTable->setColumnWidth(4,20*fm.width("w")); connect(errorTable, SIGNAL(clicked(const QModelIndex &)), this, SLOT(clickedOnLogModelIndex(const QModelIndex &))); errorTable->horizontalHeader()->setStretchLastSection(true); errorTable->setMinimumHeight(5*rowHeight); errorTable->setFrameShape(QFrame::NoFrame); errorTable->setSortingEnabled(true); proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel(logModel); errorTable->setModel(proxyModel); QAction * act = new QAction(tr("&Copy"),errorTable); connect(act, SIGNAL(triggered()), SLOT(copyMessage())); errorTable->addAction(act); act = new QAction(tr("&Copy All"),errorTable); connect(act, SIGNAL(triggered()), SLOT(copyAllMessages())); errorTable->addAction(act); act = new QAction(tr("&Copy All With Line Numbers"),errorTable); connect(act, SIGNAL(triggered()), SLOT(copyAllMessagesWithLineNumbers())); errorTable->addAction(act); errorTable->setContextMenuPolicy(Qt::ActionsContextMenu); log = new LogEditor(this); log->setFocusPolicy(Qt::ClickFocus); log->setMinimumHeight(3*(fm.lineSpacing()+4)); log->setReadOnly(true); connect(log, SIGNAL(clickOnLogLine(int)),this,SLOT(gotoLogLine(int))); QSplitter *splitter = new QSplitter(Qt::Vertical, this); splitter->setChildrenCollapsible(false); splitter->addWidget(errorTable); splitter->addWidget(log); infoLabel = new QLabel(tr("No log file available"), this); infoLabel->setStyleSheet("background: #FFFBBF;"); infoLabel->setMargin(2); QVBoxLayout* vLayout = new QVBoxLayout(); //contains the widgets for the normal mode (OutputTable + OutputLogTextEdit) vLayout->setSpacing(0); vLayout->setMargin(0); vLayout->addWidget(infoLabel); vLayout->addWidget(splitter); setLayout(vLayout); displayPartsActions = new QActionGroup(this); displayPartsActions->setExclusive(true); connect(displayPartsActions, SIGNAL(triggered(QAction*)), this, SLOT(changeDisplay(QAction *))); displayTableAction = new QAction(tr("Issues"), displayPartsActions); displayTableAction->setData(qVariantFromValue(DisplayTable)); displayTableAction->setCheckable(true); displayLogAction = new QAction(tr("Log File"), displayPartsActions); displayLogAction->setData(qVariantFromValue(DisplayLog)); displayLogAction->setCheckable(true); displayLogAndTableAction = new QAction(tr("Issues and Log"), displayPartsActions); displayLogAndTableAction->setData(qVariantFromValue(DisplayLogAndTable)); displayLogAndTableAction->setCheckable(true); filterErrorAction = new QAction(QIcon(":/images-ng/error.svgz"),tr("Show Error"),this); filterErrorAction->setCheckable(true); filterErrorAction->setChecked(true); connect(filterErrorAction,SIGNAL(toggled(bool)),this,SLOT(filterChanged(bool))); filterWarningAction = new QAction(QIcon(":/images-ng/warning.svgz"),tr("Show Warning"),this); filterWarningAction->setCheckable(true); filterWarningAction->setChecked(true); connect(filterWarningAction,SIGNAL(toggled(bool)),this,SLOT(filterChanged(bool))); filterBadBoxAction = new QAction(QIcon(":/images-ng/badbox.svg"),tr("Show BadBox"),this); filterBadBoxAction->setCheckable(true); filterBadBoxAction->setChecked(true); connect(filterBadBoxAction,SIGNAL(toggled(bool)),this,SLOT(filterChanged(bool))); setDisplayParts(DisplayTable); }
CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent) { QHBoxLayout *layout5 = new QHBoxLayout; setLayout(layout5); ManScreen *screen = new ManScreen; layout5->addWidget(screen); QVBoxLayout *layout6 = new QVBoxLayout; layout5->addLayout(layout6); // QGroupBox *headBox = new QGroupBox(tr("head")); layout6->addWidget(headBox); QVBoxLayout *layout7 = new QVBoxLayout; headBox->setLayout(layout7); QLineEdit *headText = new QLineEdit(); headText->setPlaceholderText(tr("Enter formula...")); layout7->addWidget(headText); FormulaValidator *headValidator = new FormulaValidator(); connect(headText, SIGNAL(textChanged(QString)), headValidator, SLOT(reciveText(QString))); connect(headValidator, SIGNAL(newValidFormula(QString)), screen, SLOT(setHeadFormula(QString))); // QGroupBox *bodyBox = new QGroupBox(tr("body")); layout6->addWidget(bodyBox); QVBoxLayout *layout8 = new QVBoxLayout; bodyBox->setLayout(layout8); QLineEdit *bodyText = new QLineEdit(); bodyText->setPlaceholderText(tr("Enter formula...")); layout8->addWidget(bodyText); FormulaValidator *bodyValidator = new FormulaValidator(); connect(bodyText, SIGNAL(textChanged(QString)), bodyValidator, SLOT(reciveText(QString))); connect(bodyValidator, SIGNAL(newValidFormula(QString)), screen, SLOT(setBodyFormula(QString))); // QGroupBox *leftHandBox = new QGroupBox(tr("left hand")); layout6->addWidget(leftHandBox); QVBoxLayout *layout9 = new QVBoxLayout; leftHandBox->setLayout(layout9); QLineEdit *leftHandText = new QLineEdit(); leftHandText->setPlaceholderText(tr("Enter formula...")); layout9->addWidget(leftHandText); FormulaValidator *leftHandValidator = new FormulaValidator(); connect(leftHandText, SIGNAL(textChanged(QString)), leftHandValidator, SLOT(reciveText(QString))); connect(leftHandValidator, SIGNAL(newValidFormula(QString)), screen, SLOT(setLeftHandFormula(QString))); // QGroupBox *rightHandBox = new QGroupBox(tr("right hand")); layout6->addWidget(rightHandBox); QVBoxLayout *layout10 = new QVBoxLayout; rightHandBox->setLayout(layout10); QLineEdit *rightHandText = new QLineEdit(); rightHandText->setPlaceholderText(tr("Enter formula...")); layout10->addWidget(rightHandText); FormulaValidator *rightHandValidator = new FormulaValidator(); connect(rightHandText, SIGNAL(textChanged(QString)), rightHandValidator, SLOT(reciveText(QString))); connect(rightHandValidator, SIGNAL(newValidFormula(QString)), screen, SLOT(setRightHandFormula(QString))); // QGroupBox *leftLegBox = new QGroupBox(tr("left leg")); layout6->addWidget(leftLegBox); QVBoxLayout *layout11 = new QVBoxLayout; leftLegBox->setLayout(layout11); QLineEdit *leftLegText = new QLineEdit(); leftLegText->setPlaceholderText(tr("Enter formula...")); layout11->addWidget(leftLegText); FormulaValidator *leftLegValidator = new FormulaValidator(); connect(leftLegText, SIGNAL(textChanged(QString)), leftLegValidator, SLOT(reciveText(QString))); connect(leftLegValidator, SIGNAL(newValidFormula(QString)), screen, SLOT(setLeftLegFormula(QString))); // QGroupBox *rightLegBox = new QGroupBox(tr("right leg")); layout6->addWidget(rightLegBox); QVBoxLayout *layout12 = new QVBoxLayout; rightLegBox->setLayout(layout12); QLineEdit *rightLegText = new QLineEdit(); rightLegText->setPlaceholderText(tr("Enter formula...")); layout12->addWidget(rightLegText); FormulaValidator *rightLegValidator = new FormulaValidator(); connect(rightLegText, SIGNAL(textChanged(QString)), rightLegValidator, SLOT(reciveText(QString))); connect(rightLegValidator, SIGNAL(newValidFormula(QString)), screen, SLOT(setRightLegFormula(QString))); }
AddressBook::AddressBook(QWidget *parent) : QWidget(parent) { QLabel *nameLabel = new QLabel(tr("Name:")); nameLine = new QLineEdit; nameLine->setReadOnly(true); QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; addressText->setReadOnly(true); addButton = new QPushButton(tr("&Add")); editButton = new QPushButton(tr("&Edit")); editButton->setEnabled(false); removeButton = new QPushButton(tr("&Remove")); removeButton->setEnabled(false); //! [instantiating findButton] findButton = new QPushButton(tr("&Find")); findButton->setEnabled(false); //! [instantiating findButton] submitButton = new QPushButton(tr("&Submit")); submitButton->hide(); cancelButton = new QPushButton(tr("&Cancel")); cancelButton->hide(); nextButton = new QPushButton(tr("&Next")); nextButton->setEnabled(false); previousButton = new QPushButton(tr("&Previous")); previousButton->setEnabled(false); //! [instantiating FindDialog] dialog = new FindDialog; //! [instantiating FindDialog] connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); connect(editButton, SIGNAL(clicked()), this, SLOT(editContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContact())); //! [signals and slots for find] connect(findButton, SIGNAL(clicked()), this, SLOT(findContact())); //! [signals and slots for find] connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); buttonLayout1->addWidget(removeButton); //! [adding findButton to layout] buttonLayout1->addWidget(findButton); //! [adding findButton to layout] buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addStretch(); QHBoxLayout *buttonLayout2 = new QHBoxLayout; buttonLayout2->addWidget(previousButton); buttonLayout2->addWidget(nextButton); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(nameLabel, 0, 0); mainLayout->addWidget(nameLine, 0, 1); mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop); mainLayout->addWidget(addressText, 1, 1); mainLayout->addLayout(buttonLayout1, 1, 2); mainLayout->addLayout(buttonLayout2, 2, 1); setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); }
BlockingClient::BlockingClient(QWidget *parent) : QDialog(parent) { hostLabel = new QLabel(tr("&Server name:")); portLabel = new QLabel(tr("S&erver port:")); // find out which IP to connect to QString ipAddress; QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses(); // use the first non-localhost IPv4 address for (int i = 0; i < ipAddressesList.size(); ++i) { if (ipAddressesList.at(i) != QHostAddress::LocalHost && ipAddressesList.at(i).toIPv4Address()) { ipAddress = ipAddressesList.at(i).toString(); break; } } // if we did not find one, use IPv4 localhost if (ipAddress.isEmpty()) ipAddress = QHostAddress(QHostAddress::LocalHost).toString(); hostLineEdit = new QLineEdit(ipAddress); portLineEdit = new QLineEdit; portLineEdit->setValidator(new QIntValidator(1, 65535, this)); hostLabel->setBuddy(hostLineEdit); portLabel->setBuddy(portLineEdit); statusLabel = new QLabel(tr("This examples requires that you run the " "Fortune Server example as well.")); getFortuneButton = new QPushButton(tr("Get Fortune")); getFortuneButton->setDefault(true); getFortuneButton->setEnabled(false); quitButton = new QPushButton(tr("Quit")); buttonBox = new QDialogButtonBox; buttonBox->addButton(getFortuneButton, QDialogButtonBox::ActionRole); buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole); connect(hostLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableGetFortuneButton())); connect(portLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableGetFortuneButton())); connect(getFortuneButton, SIGNAL(clicked()), this, SLOT(requestNewFortune())); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); //! [0] connect(&thread, SIGNAL(newFortune(QString)), this, SLOT(showFortune(QString))); //! [0] //! [1] connect(&thread, SIGNAL(error(int,QString)), this, SLOT(displayError(int,QString))); //! [1] QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(hostLabel, 0, 0); mainLayout->addWidget(hostLineEdit, 0, 1); mainLayout->addWidget(portLabel, 1, 0); mainLayout->addWidget(portLineEdit, 1, 1); mainLayout->addWidget(statusLabel, 2, 0, 1, 2); mainLayout->addWidget(buttonBox, 3, 0, 1, 2); setLayout(mainLayout); setWindowTitle(tr("Blocking Fortune Client")); portLineEdit->setFocus(); }
void LogConfigDialog::buildDialog() { setWindowTitle(tr("Configure Logging")); QPushButton* button; QVBoxLayout *vLayout; QHBoxLayout *hLayout; QFormLayout *fLayout = new QFormLayout; m_configFilePath = new QLineEdit(); m_logFilePath = new QLineEdit(); hLayout = new QHBoxLayout(); vLayout = new QVBoxLayout(); vLayout->addWidget(new QLabel(tr("Configuration File: "))); vLayout->addWidget(new QLabel(tr("Log File: "))); hLayout->addLayout(vLayout); vLayout = new QVBoxLayout(); vLayout->addWidget(m_configFilePath); vLayout->addWidget(m_logFilePath); hLayout->addLayout(vLayout); vLayout = new QVBoxLayout(); button = new QPushButton(tr("Load")); connect(button, SIGNAL(clicked()), this, SLOT(loadLogConfiguration())); vLayout->addWidget(button); button = new QPushButton(tr("Select")); connect(button, SIGNAL(clicked()), this, SLOT(selectLogFile())); vLayout->addWidget(button); hLayout->addLayout(vLayout); vLayout = new QVBoxLayout(); button = new QPushButton(tr("Save")); connect(button, SIGNAL(clicked()), this, SLOT(saveLogConfiguration())); vLayout->addWidget(button); vLayout->addStretch(); hLayout->addLayout(vLayout); fLayout->addRow(hLayout); hLayout = new QHBoxLayout(); vLayout = new QVBoxLayout(); vLayout->addWidget(new QLabel(tr("Routings:"))); button = new QPushButton(tr("Edit")); connect(button, SIGNAL(clicked()), this, SLOT(editSelectedRouting())); vLayout->addWidget(button); button = new QPushButton(tr("Add")); connect(button, SIGNAL(clicked()), this, SLOT(addRouting())); vLayout->addWidget(button); button = new QPushButton(tr("Copy")); connect(button, SIGNAL(clicked()), this, SLOT(copyRouting())); vLayout->addWidget(button); button = new QPushButton(tr("Delete")); connect(button, SIGNAL(clicked()), this, SLOT(delSelectedRouting())); vLayout->addWidget(button); vLayout->addStretch(); hLayout->addLayout(vLayout); m_routingTableView = new QTableView(); m_tableModel = new LogRoutingInfoTableModel(); m_routingTableView->setModel(m_tableModel); LinkBackFilterDelegate* delegate = new LinkBackFilterDelegate(m_routingTableView); m_routingTableView->setItemDelegate(delegate); CheckBoxOnlyDelegate * cboDelegate = new CheckBoxOnlyDelegate(m_routingTableView); m_routingTableView->setItemDelegateForColumn(LogRoutingInfoTableModel::enabledColumn, cboDelegate); m_routingTableView->setItemDelegateForColumn(LogRoutingInfoTableModel::routFileColumn, cboDelegate); m_routingTableView->setItemDelegateForColumn(LogRoutingInfoTableModel::routScreenColumn, cboDelegate); m_routingTableView->setItemDelegateForColumn(LogRoutingInfoTableModel::routDebugColumn, cboDelegate); hLayout->addWidget(m_routingTableView); fLayout->addRow(hLayout); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); fLayout->addRow(buttonBox); setLayout(fLayout); QSettings settings; restoreGeometry(settings.value("LogConfigDialogGeometry").toByteArray()); setConfigFilePath(settings.value("LogConfigDialogLastConfigPath").toString()); QString s = settings.value("LogConfigDialogRoutingColumnWidths").toString(); if (s.length() > 0) { QStringList list = s.split(','); bool ok = true; for (int i=0; i<list.count() && i<LogRoutingInfoTableModel::numColumns; ++i) { int width = list[i].toInt(&ok); if (ok && width > 0) { m_routingTableView->setColumnWidth(i, width); } } } }
/* Constructor */ ModFrame::ModFrame(FilterWin *parent) : QFrame(parent), filterWin(parent) { // base layout QVBoxLayout * layout = new QVBoxLayout; QVBoxLayout * vbox; QHBoxLayout * hbox; QFrame * frame; int i; // mode div frame = new QFrame; vbox = new QVBoxLayout; frame->setLayout(vbox); addLabelRow(vbox, "Mode:"); hbox = new QHBoxLayout; modeRadios[MOVIESOAP_SKIP] = addRadio(hbox, "&Skip"); modeRadios[MOVIESOAP_MUTE] = addRadio(hbox, "&Mute"); modeRadios[MOVIESOAP_BLACKOUT] = addRadio(hbox, "&Blackout"); QPushButton *blackoutButton = addButton(hbox, "S&et blackout bounds"); connect( blackoutButton, SIGNAL(clicked()), this, SLOT(blackoutClicked()) ); vbox->addLayout(hbox); layout->addWidget(frame); // time div addLabelRow(layout, "Time:"); hbox = new QHBoxLayout; hbox->addWidget(new QLabel(tr("from"))); startText = addText(hbox, "00:00:00.00"); startText->setFixedWidth(110); hbox->addWidget(new QLabel(tr("to"))); stopText = addText(hbox, "00:00:00.00"); stopText->setFixedWidth(110); hbox->addWidget(new QLabel(tr("title"))); titleText = addText(hbox, "-1"); titleText->setFixedWidth(50); layout->addLayout(hbox); // severity/tolerance div frame = new QFrame; vbox = new QVBoxLayout; frame->setLayout(vbox); addLabel(vbox, "Offensiveness (scarcely <-> very)"); hbox = new QHBoxLayout; for (i = 0; i < MOVIESOAP_TOLERANCE_COUNT-1; i++) { severityRadios[i] = addRadio(hbox); } vbox->addLayout(hbox); layout->addWidget(frame); // category div hbox = new QHBoxLayout; addLabel(hbox, "Category:"); categoryBox = new QComboBox; for (i = 0; i < MOVIESOAP_CAT_COUNT; i ++) { categoryBox->addItem(QString(toleranceLabels[i]), QVariant(i)); } hbox->addWidget(categoryBox); layout->addLayout(hbox); // description div hbox = new QHBoxLayout; addLabel(hbox, "Description:"); descText = addText(hbox, "e.g. skip shootout scene"); layout->addLayout(hbox); // Submit div hbox = new QHBoxLayout; QPushButton * okButton = addButton(hbox, "&Ok"); QPushButton * cancelButton = addButton(hbox, "<< (&cancel)"); layout->addLayout(hbox); connect( okButton, SIGNAL(clicked()), this, SLOT(okClicked()) ); connect( cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()) ); hbox = new QHBoxLayout; QPushButton * previewButton = addButton(hbox, "&Preview edit"); layout->addLayout(hbox); connect( previewButton, SIGNAL(clicked()), this, SLOT(previewClicked()) ); // finish hbox = new QHBoxLayout; layout->addLayout(hbox, 9); setLayout(layout); }
AddTaskDialog::AddTaskDialog(SharedData * pSharedData) : QDialog(NULL, Qt::Dialog|Qt::WindowSystemMenuHint){ int currentRobot; QString name; bool bAdd; setModal(true); m_pSharedData = pSharedData; m_pAddButton = new QPushButton(tr("Add Task")); m_pCancelButton = new QPushButton(tr("Cancel")); connect(m_pAddButton, SIGNAL(clicked()), this, SLOT(accept())); connect(m_pCancelButton, SIGNAL(clicked()), this, SLOT(reject())); m_pRobotLabel = new QLabel(tr("Robot:")); m_pRobotList = new QComboBox(); m_pRobotList->setEditable(false); connect(m_pRobotList, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateWaypointList(int))); m_pWaypointList = new QListWidget; m_pUp = new QPushButton(QIcon("images/up.png"), ""); m_pDown = new QPushButton(QIcon("images/down.png"), ""); connect(m_pUp, SIGNAL(clicked()), this, SLOT(MoveUp())); connect(m_pDown, SIGNAL(clicked()), this, SLOT(MoveDown())); // Add robots to list for(int iter = 0; iter < MAX_NUM_ROBOTS; iter++){ bAdd = false; m_pSharedData->Lock(); if(m_pSharedData->DoesRobotExist(iter)){ bAdd = true; name.clear(); name.append(m_pSharedData->GetRobotData(iter)->configuration.name); } m_pSharedData->Unlock(); if(bAdd){ m_pRobotList->addItem(name, QVariant(iter)); } } // Set the current robot as the active list item m_pSharedData->Lock(); currentRobot = (int)m_pSharedData->GetCurrentRobot(); m_pSharedData->Unlock(); m_pRobotList->setCurrentIndex(m_pRobotList->findData(currentRobot)); UpdateWaypointList(m_pRobotList->currentIndex()); m_pTaskLabel = new QLabel(tr("Task:")); m_pTaskList = new QComboBox; connect(m_pTaskList, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateSelectedTask(int))); m_pTaskList->addItem(tr("Waypoint"), QVariant((int)TASK_WAYPOINT)); m_pTaskList->addItem(tr("Take chemical sample"), QVariant((int)TASK_CHEMICAL_SAMPLE)); m_pTaskList->addItem(tr("Take dirt sample"), QVariant((int)TASK_DIRT_SAMPLE)); m_pTaskList->setCurrentIndex(TASK_WAYPOINT); m_lSelectedTask = TASK_WAYPOINT; QHBoxLayout * pRobotLayout = new QHBoxLayout; pRobotLayout->addStretch(); pRobotLayout->addWidget(m_pRobotLabel); pRobotLayout->addWidget(m_pRobotList); pRobotLayout->addStretch(); QHBoxLayout * pWaypointLayout = new QHBoxLayout; pWaypointLayout->addWidget(m_pWaypointList); QVBoxLayout * pUpDownLayout = new QVBoxLayout; pUpDownLayout->addStretch(); pUpDownLayout->addWidget(m_pUp); pUpDownLayout->addWidget(m_pDown); pUpDownLayout->addStretch(); pWaypointLayout->addLayout(pUpDownLayout); QHBoxLayout * pAddCancelLayout = new QHBoxLayout; pAddCancelLayout->addWidget(m_pAddButton); pAddCancelLayout->addWidget(m_pCancelButton); QHBoxLayout * pTaskLayout = new QHBoxLayout; pTaskLayout->addWidget(m_pTaskLabel); pTaskLayout->addWidget(m_pTaskList); QVBoxLayout * pMainLayout = new QVBoxLayout; pMainLayout->addLayout(pRobotLayout); pMainLayout->addLayout(pWaypointLayout); pMainLayout->addLayout(pTaskLayout); pMainLayout->addLayout(pAddCancelLayout); setLayout(pMainLayout); }
void EditorPreferencesWidget::initializeGUI() { layout = new QGridLayout(this); // Initialize our general group box. generalGroupBox = new QGroupBox(tr("General"), this); generalLayout = new QGridLayout(generalGroupBox); showGutterCheckBox = new QCheckBox(tr("Show Gutter"), generalGroupBox); editorFontLabel = new QLabel(tr("Editor Font"), generalGroupBox, nullptr); editorFontButton = new FontPickerButton(generalGroupBox); indentationWidthLabel = new QLabel(tr("Indentation Width"), generalGroupBox, nullptr); indentationWidthSpinBox = new QSpinBox(generalGroupBox); indentationWidthSpinBox->setMinimum(2); indentationWidthSpinBox->setMaximum(24); indentationModeLabel = new QLabel(tr("Indentation Mode"), generalGroupBox, nullptr); indentationModeButtonGroup = new QButtonGroup(generalGroupBox); indentationModeTabsRadioButton = new QRadioButton(tr("Tabs"), generalGroupBox); indentationModeSpacesRadioButton = new QRadioButton(tr("Spaces"), generalGroupBox); indentationModeButtonGroup->addButton(indentationModeTabsRadioButton); indentationModeButtonGroup->addButton(indentationModeSpacesRadioButton); generalLayout->addWidget(showGutterCheckBox, 0, 0, 1, 1, nullptr); generalLayout->addWidget(editorFontLabel, 1, 0, 1, 1, nullptr); generalLayout->addWidget(editorFontButton, 1, 1, 1, 1, nullptr); generalLayout->addWidget(indentationWidthLabel, 2, 0, 1, 1, nullptr); generalLayout->addWidget(indentationWidthSpinBox, 2, 1, 1, 1, nullptr); generalLayout->addWidget(indentationModeLabel, 3, 0, 1, 1, nullptr); generalLayout->addWidget(indentationModeTabsRadioButton, 3, 1, 1, 1, nullptr); generalLayout->addWidget(indentationModeSpacesRadioButton, 4, 1, 1, 1, nullptr); generalLayout->setRowStretch(5, 1); generalLayout->setColumnStretch(0, 1); generalGroupBox->setLayout(generalLayout); // Initialize our line wrap guide group box. lineWrapGuideGroupBox = new QGroupBox(tr("Line Wrap Guide"), this); lineWrapGuideLayout = new QGridLayout(lineWrapGuideGroupBox); lineWrapGuideCheckBox = new QCheckBox(tr("Show Guide (Monospaced fonts only.)"), lineWrapGuideGroupBox); lineWrapGuideWidthLabel = new QLabel(tr("Character Width"), lineWrapGuideGroupBox, nullptr); lineWrapGuideWidthSpinBox = new QSpinBox(lineWrapGuideGroupBox); lineWrapGuideWidthSpinBox->setMinimum(10); lineWrapGuideWidthSpinBox->setMaximum(500); lineWrapGuideColorLabel = new QLabel(tr("Color"), lineWrapGuideGroupBox, nullptr); lineWrapGuideColorButton = new ColorPickerButton(lineWrapGuideGroupBox); lineWrapGuideLayout->addWidget(lineWrapGuideCheckBox, 0, 0, 1, 1, nullptr); lineWrapGuideLayout->addWidget(lineWrapGuideWidthLabel, 1, 0, 1, 1, nullptr); lineWrapGuideLayout->addWidget(lineWrapGuideWidthSpinBox, 1, 1, 1, 1, nullptr); lineWrapGuideLayout->addWidget(lineWrapGuideColorLabel, 2, 0, 1, 1, nullptr); lineWrapGuideLayout->addWidget(lineWrapGuideColorButton, 2, 1, 1, 1, nullptr); lineWrapGuideLayout->setRowStretch(3, 1); lineWrapGuideLayout->setColumnStretch(0, 1); lineWrapGuideGroupBox->setLayout(lineWrapGuideLayout); // Initialize our colors group box. colorsGroupBox = new QGroupBox(tr("Colors"), this); colorsLayout = new QGridLayout(colorsGroupBox); editorFGLabel = new QLabel(tr("Editor Foreground"), colorsGroupBox, nullptr); editorFGButton = new ColorPickerButton(colorsGroupBox); editorBGLabel = new QLabel(tr("Editor Background"), colorsGroupBox, nullptr); editorBGButton = new ColorPickerButton(colorsGroupBox); currentLineBGLabel = new QLabel(tr("Current Line Background"), colorsGroupBox, nullptr); currentLineBGButton = new ColorPickerButton(colorsGroupBox); gutterFGLabel = new QLabel(tr("Gutter Foreground"), colorsGroupBox, nullptr); gutterFGButton = new ColorPickerButton(colorsGroupBox); gutterBGLabel = new QLabel(tr("Gutter Background"), colorsGroupBox, nullptr); gutterBGButton = new ColorPickerButton(colorsGroupBox); colorsLayout->addWidget(editorFGLabel, 0, 0, 1, 1, nullptr); colorsLayout->addWidget(editorFGButton, 0, 1, 1, 1, nullptr); colorsLayout->addWidget(editorBGLabel, 1, 0, 1, 1, nullptr); colorsLayout->addWidget(editorBGButton, 1, 1, 1, 1, nullptr); colorsLayout->addWidget(currentLineBGLabel, 2, 0, 1, 1, nullptr); colorsLayout->addWidget(currentLineBGButton, 2, 1, 1, 1, nullptr); colorsLayout->addWidget(gutterFGLabel, 3, 0, 1, 1, nullptr); colorsLayout->addWidget(gutterFGButton, 3, 1, 1, 1, nullptr); colorsLayout->addWidget(gutterBGLabel, 4, 0, 1, 1, nullptr); colorsLayout->addWidget(gutterBGButton, 4, 1, 1, 1, nullptr); colorsLayout->setRowStretch(5, 1); colorsLayout->setColumnStretch(0, 1); colorsGroupBox->setLayout(colorsLayout); // Add these group boxes to our layout. layout->addWidget(generalGroupBox, 1, 0, 1, 1, nullptr); layout->addWidget(lineWrapGuideGroupBox, 2, 0, 1, 1, nullptr); layout->addWidget(colorsGroupBox, 3, 0, 1, 1, nullptr); layout->setColumnStretch(0, 1); layout->setRowStretch(4, 1); setLayout(layout); }
void MainWindow::addWidgets() { Q_D(MainWindow); int i = 0; d->mainContainer = new QWidget(this); // Selectors and file chooser d->deviceSel = new QComboBox(d->mainContainer); d->instLocSel = new QComboBox(d->mainContainer); d->instLocDesc = new QLabel(d->mainContainer); // Labels d->deviceLbl = new QLabel(tr("Device:"), d->mainContainer); d->instLocLbl = new QLabel(tr("Install to:"), d->mainContainer); // Text boxes d->instLocLe = new QLineEdit(d->mainContainer); d->instLocLe->setPlaceholderText(tr("Enter an ID")); QRegExp re(QStringLiteral("[a-z0-9]+")); QValidator *validator = new QRegExpValidator(re, this); d->instLocLe->setValidator(validator); QGridLayout *layout = new QGridLayout(d->mainContainer); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(d->deviceLbl, i, 0); layout->addWidget(d->deviceSel, i, 1, 1, -1); layout->addWidget(d->instLocLbl, ++i, 0); layout->addWidget(d->instLocSel, i, 1, 1, -1); layout->addWidget(d->instLocLe, ++i, 1, 1, -1); layout->addWidget(d->instLocDesc, ++i, 1, 1, -1); d->messageLbl = new QLabel(d->mainContainer); // Don't allow the window to grow too big d->messageLbl->setWordWrap(true); d->messageLbl->setMaximumWidth(550); d->chooseFileBtn = new QPushButton(tr("Choose file"), d->mainContainer); d->chooseAnotherFileBtn = new QPushButton(tr("Choose another file"), d->mainContainer); d->startPatchingBtn = new QPushButton(tr("Start patching"), d->mainContainer); d->buttons = new QDialogButtonBox(d->mainContainer); d->buttons->addButton(d->chooseFileBtn, QDialogButtonBox::ActionRole); d->buttons->addButton(d->chooseAnotherFileBtn, QDialogButtonBox::ActionRole); d->buttons->addButton(d->startPatchingBtn, QDialogButtonBox::ActionRole); QWidget *horiz1 = newHorizLine(d->mainContainer); layout->setColumnStretch(0, 0); layout->setColumnStretch(1, 0); layout->setColumnStretch(2, 0); layout->setColumnStretch(3, 1); layout->addWidget(horiz1, ++i, 0, 1, -1); layout->addWidget(d->messageLbl, ++i, 0, 1, -1); layout->addWidget(newHorizLine(d->mainContainer), ++i, 0, 1, -1); layout->addWidget(d->buttons, ++i, 0, 1, -1); d->mainContainer->setLayout(layout); // List of widgets related to the message label d->messageWidgets << horiz1; d->messageWidgets << d->messageLbl; // Buttons d->progressContainer = new QWidget(this); QBoxLayout *progressLayout = new QVBoxLayout(d->progressContainer); progressLayout->setContentsMargins(0, 0, 0, 0); QGroupBox *detailsBox = new QGroupBox(d->progressContainer); detailsBox->setTitle(tr("Details")); d->detailsLbl = new QLabel(detailsBox); d->detailsLbl->setWordWrap(true); // Make sure the window doesn't change size while patching d->detailsLbl->setFixedWidth(500); QVBoxLayout *detailsLayout = new QVBoxLayout(detailsBox); detailsLayout->addWidget(d->detailsLbl); detailsBox->setLayout(detailsLayout); d->progressBar = new QProgressBar(d->progressContainer); //d->progressBar->setFormat(tr("%p% - %v / %m files")); d->progressBar->setMaximum(0); d->progressBar->setMinimum(0); d->progressBar->setValue(0); progressLayout->addWidget(detailsBox); //progressLayout->addStretch(1); progressLayout->addWidget(newHorizLine(d->progressContainer)); progressLayout->addWidget(d->progressBar); d->progressContainer->setLayout(progressLayout); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setSizeConstraint(QLayout::SetFixedSize); mainLayout->addWidget(d->mainContainer); mainLayout->addWidget(d->progressContainer); setLayout(mainLayout); }
QxCommandEditor::QxCommandEditor(QWidget* parent) : QxDialog(parent), iconSelector_(new QxIconSelector(parent)), command_(0) { setWindowTitle(qApp->applicationName() + tr("- Edit Command")); QVBoxLayout* col = new QVBoxLayout; { QFormLayout* form = new QFormLayout; form->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); { icon_ = new QToolButton(this); icon_->setText("..."); icon_->setIconSize(QSize(24, 24)); iconReset_ = new QToolButton(this); iconReset_->setText(tr("Reset")); connect(icon_, SIGNAL(clicked()), this, SLOT(loadIcon())); connect(iconReset_, SIGNAL(clicked()), this, SLOT(resetIcon())); QHBoxLayout* row = new QHBoxLayout; row->addWidget(icon_); row->addWidget(iconReset_); row->addStretch(); form->addRow(tr("Icon"), row); } { noDescription_ = tr("<optional text>"); description_ = new QLineEdit(this); description_->setText(noDescription_); form->addRow(tr("Description"), description_); } { modifier_ = new QComboBox(this); modifier_->addItem(tr("None")); modifier_->addItem(tr("Alt"), Qt::Key_Alt); modifier_->addItem(tr("Control"), Qt::Key_Control); modifier_->addItem(tr("Meta"), Qt::Key_Meta); keyGroup_ = new QComboBox(this); keyGroup_->addItem(tr("F1-F12")); keyGroup_->addItem(tr("0-9")); key_ = new QComboBox(this); connect(keyGroup_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateKey(int))); updateKey(0); QHBoxLayout* row = new QHBoxLayout; row->addWidget(modifier_); row->addWidget(keyGroup_); row->addWidget(key_); row->addStretch(); form->addRow(tr("Short key"), row); } { scriptLabel_ = new QLabel(tr("Script"), this); target_ = new QComboBox(this); target_->addItem(tr("Paste into current terminal"), QxCommand::ActiveTerminal); target_->addItem(tr("Paste into new terminal"), QxCommand::NewTerminal); // target_->addItem(tr("Paste into editor"), QxCommand::TextEditor); target_->addItem(tr("Open by default application"), QxCommand::WebBrowser); connect(target_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTarget(int))); QHBoxLayout* row = new QHBoxLayout; row->addWidget(target_); row->addStretch(); form->addRow(scriptLabel_, row); } { autoSaveFile_ = new QCheckBox(tr("Automatically save current file"), this); autoOpenNextLink_ = new QCheckBox(tr("Automatically open next link"), this); QVBoxLayout* col = new QVBoxLayout(); col->addWidget(autoSaveFile_); col->addWidget(autoOpenNextLink_); form->addRow(tr("Options"), col); } col->addLayout(form); } { QFrame* frame = new QFrame(this); frame->setFrameStyle(QFrame::Sunken|QFrame::StyledPanel); script_ = new EditWidget(frame); script_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QHBoxLayout* cell = new QHBoxLayout; cell->setSpacing(0); cell->setMargin(0); cell->addWidget(script_); frame->setLayout(cell); QMenu* editMenu = script_->edit()->contextMenu(); editMenu->addSeparator(); QMenu* substMenu = editMenu->addMenu(tr("Insert $SUBST")); const char* substNames[] = { "$DIRPATH", "$DIRNAME", "$FILEPATH", "$FILENAME", "$FILEID", "$FILEEXT", "$TEXT", "$WORD", "$CURSOR_LINE", "$CURSOR_COLUMN", "$OFFSET" }; for (int i = 0, n = sizeof(substNames) / sizeof(const char*); i < n; ++i) substMenu->addAction(substNames[i]); connect(substMenu, SIGNAL(triggered(QAction*)), this, SLOT(substTriggered(QAction*))); col->addWidget(frame); } { QDialogButtonBox* box = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); connect(box, SIGNAL(accepted()), this, SLOT(accept())); connect(box, SIGNAL(rejected()), this, SLOT(reject())); col->addWidget(box); } setLayout(col); // design HACK resize(parent->size() * 1.2); connect(this, SIGNAL(accepted()), this, SLOT(updateCommand())); }
void View::Management::ProductDialog::createWidgets() { _idLabel = new QLabel(tr("&Id:")); _idLineEdit = new QLineEdit; _idLineEdit -> setValidator(new QRegExpValidator(QRegExp("[1-9][0-9]*"), this)); _idLabel -> setBuddy(_idLineEdit); _autoIdCheckBox = new QCheckBox(tr("Auto &Generate")); _nameLabel = new QLabel(tr("&Name:")); _nameLineEdit = new QLineEdit; _nameLabel -> setBuddy(_nameLineEdit); _categoryLabel = new QLabel(tr("&Category:")); _categoryComboBox = new QComboBox; _categoryComboBox -> addItems(Model::Management::CategoryManager::getAllNames().keys()); _categoryLabel -> setBuddy(_categoryComboBox); _descriptionLabel = new QLabel(tr("&Description:")); _descriptionTextEdit = new QTextEdit; _descriptionLabel -> setBuddy(_descriptionTextEdit); _descriptionTextEdit->setMaximumHeight(50); _priceLabel = new QLabel(tr("&Price:")); _priceLineEdit = new QLineEdit; _priceLineEdit -> setValidator(new QRegExpValidator(QRegExp("[0-9]+(.[0-9]+)?"), this)); _priceLabel -> setBuddy(_priceLineEdit); _priceTypeLabel = new QLabel(tr("&Type:")); _priceTypeComboBox = new QComboBox; _priceTypeComboBox -> addItems(QStringList() << tr("Units") << tr("Weight")); _priceTypeLabel -> setBuddy(_priceTypeComboBox); QGridLayout *topLayout = new QGridLayout; topLayout -> addWidget(_idLabel, 0, 0, 1, 1); topLayout -> addWidget(_idLineEdit, 0, 1, 1, 1); topLayout -> addWidget(_autoIdCheckBox, 0, 2, 1, 2); topLayout -> addWidget(_nameLabel, 1, 0, 1, 1); topLayout -> addWidget(_nameLineEdit, 1, 1, 1, 3); topLayout -> addWidget(_categoryLabel, 2, 0, 1, 1); topLayout -> addWidget(_categoryComboBox, 2, 1, 1, 2); topLayout -> addWidget(_descriptionLabel, 3, 0, 1, 2); topLayout -> addWidget(_descriptionTextEdit, 4, 0, 1, 4); topLayout -> addWidget(_priceLabel, 5, 0, 1, 1); topLayout -> addWidget(_priceLineEdit, 5, 1, 1, 1); topLayout -> addWidget(_priceTypeLabel, 5, 2, 1, 1); topLayout -> addWidget(_priceTypeComboBox, 5, 3, 1, 1); _saveButton = new QPushButton(tr("&Save")); _saveButton -> setIcon(QIcon(":/images/save.png")); _saveButton -> setDefault(true); _saveButton -> setEnabled(false); _cancelButton = new QPushButton(tr("&Cancel")); _cancelButton -> setIcon(QIcon(":/images/cancel.png")); QHBoxLayout *bottomLayout = new QHBoxLayout; bottomLayout -> addStretch(); bottomLayout -> addWidget(_saveButton); bottomLayout -> addWidget(_cancelButton); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout -> addLayout(topLayout); mainLayout -> addLayout(bottomLayout); setLayout(mainLayout); }
SshTunelTab::SshTunelTab(ConnectionSettings *settings) : _settings(settings) { SSHInfo info = _settings->sshInfo(); _sshSupport = new QCheckBox("SSH support"); _sshSupport->setChecked(info.isValid()); _sshHostName = new QLineEdit(QtUtils::toQString(info._hostName)); _userName = new QLineEdit(QtUtils::toQString(info._userName)); _sshPort = new QLineEdit(QString::number(info._port)); _sshPort->setFixedWidth(80); QRegExp rx("\\d+");//(0-65554) _sshPort->setValidator(new QRegExpValidator(rx, this)); _security = new QComboBox(); _security->addItems(QStringList() << "Password" << "PublicKey"); VERIFY(connect(_security,SIGNAL(currentIndexChanged(const QString&)),this,SLOT(securityChange(const QString&)))); _passwordBox = new QLineEdit(QtUtils::toQString(info._password)); _publicKeyBox = new QLineEdit(QtUtils::toQString(info._publicKey._publicKey)); _privateKeyBox = new QLineEdit(QtUtils::toQString(info._publicKey._privateKey)); _passphraseBox = new QLineEdit(QtUtils::toQString(info._publicKey._passphrase)); #ifdef Q_OS_WIN QRegExp pathx("([a-zA-Z]:)?([\\\\/][a-zA-Z0-9_.-]+)+[\\\\/]?"); #else QRegExp pathx("^\\/?([\\d\\w\\.]+)(/([\\d\\w\\.]+))*\\/?$"); #endif // Q_OS_WIN _publicKeyBox->setValidator(new QRegExpValidator(pathx, this)); _privateKeyBox->setValidator(new QRegExpValidator(pathx, this)); QGridLayout *connectionLayout = new QGridLayout; connectionLayout->addWidget(new QLabel("SSH Host:"), 1, 0); connectionLayout->addWidget(_sshHostName, 1, 1); connectionLayout->addWidget(new QLabel("Username:"******"Port:"), 3, 0); connectionLayout->addWidget(_sshPort, 3, 1); connectionLayout->addWidget(new QLabel("Security:"), 4, 0); connectionLayout->addWidget(_security, 4, 1); _pivateKeyFrame = new QFrame; QVBoxLayout *pivL = new QVBoxLayout; pivL->setContentsMargins(0,0,0,0); QHBoxLayout *pivL1 = new QHBoxLayout; pivL1->addWidget(new QLabel("Public key:")); pivL1->addWidget(_publicKeyBox); QPushButton *selectPublicFile = new QPushButton("..."); selectPublicFile->setFixedSize(20,20); pivL1->addWidget(selectPublicFile); QHBoxLayout *pivL2 = new QHBoxLayout; pivL2->addWidget(new QLabel("Private key:")); pivL2->addWidget(_privateKeyBox); QPushButton *selectPrivateFile = new QPushButton("..."); selectPrivateFile->setFixedSize(20,20); pivL2->addWidget(selectPrivateFile); QHBoxLayout *pivL3 = new QHBoxLayout; pivL3->addWidget(new QLabel("Passphrase:")); pivL3->addWidget(_passphraseBox); pivL->addLayout(pivL1); pivL->addLayout(pivL2); pivL->addLayout(pivL3); _pivateKeyFrame->setLayout(pivL); _passwordFrame = new QFrame; QHBoxLayout *pasL = new QHBoxLayout; pasL->setContentsMargins(0,0,0,0); pasL->addWidget(new QLabel("Password:"******"PublicKey"); } else{ _security->setCurrentText("Password"); } securityChange(_security->currentText()); VERIFY(connect(selectPrivateFile, SIGNAL(clicked()), this, SLOT(setPrivateFile()))); VERIFY(connect(selectPublicFile, SIGNAL(clicked()), this, SLOT(setPublicFile()))); sshSupportStateChange(_sshSupport->checkState()); VERIFY(connect(_sshSupport,SIGNAL(stateChanged(int)),this,SLOT(sshSupportStateChange(int)))); _sshHostName->setFocus(); }
// gpSummaryTab bool gpSummaryTab::Init(gpTraceDataContainer* pDataContainer, gpTraceView* pSessionView, quint64 timelineStart, quint64 timelineEnd) { m_pTraceView = pSessionView; m_pSessionDataContainer = pDataContainer; if (m_callType == API_CALL) { m_pSummaryTable = new gpCPUTraceSummaryTable(pDataContainer, pSessionView, m_timelineAbsoluteStart); } else if (m_callType == GPU_CALL) { m_pSummaryTable = new gpGPUTraceSummaryTable(pDataContainer, pSessionView, m_timelineAbsoluteStart); } else { m_pSummaryTable = new gpCommandListSummaryTable(pDataContainer, pSessionView, m_timelineAbsoluteStart); } bool rc = m_pSummaryTable->Init(); if (rc == true) { m_pTop20Table = new acListCtrl(this); m_pTop20Caption = new QLabel(this); QHBoxLayout* pHLayout = new QHBoxLayout; QVBoxLayout* pLeftVLayout = new QVBoxLayout; QHBoxLayout* pLeftHLayout = new QHBoxLayout; QVBoxLayout* pRightVLayout = new QVBoxLayout; QSplitter* pVMainSplitter = new QSplitter(Qt::Horizontal); // set the margins to all layout to zero pHLayout->setContentsMargins(0, 0, 0, 0); pLeftVLayout->setContentsMargins(0, 0, 0, 0); pLeftHLayout->setContentsMargins(0, 0, 0, 0); pRightVLayout->setContentsMargins(0, 0, 0, 0); QWidget* pWidgetLeft = new QWidget; QWidget* pWidgetRight = new QWidget; m_pChkboxUseScope = new QCheckBox(GPU_STR_Use_Scope_Summary); QString styleSheetStr = QString("QDialog{border:1px solid gray;}"); pLeftHLayout->addWidget(m_pChkboxUseScope, 0, Qt::AlignHCenter); pLeftVLayout->addLayout(pLeftHLayout); pWidgetLeft->setLayout(pLeftVLayout); pWidgetLeft->setStyleSheet(styleSheetStr); m_pSummaryTable->resizeColumnsToContents(); pLeftVLayout->addWidget(m_pSummaryTable); m_pSummaryTable->SetSelectionBackgroundColor(acQAMD_CYAN_SELECTION_BKG_COLOUR); pLeftVLayout->setSpacing(0); pLeftVLayout->setMargin(1); QFont qFont = m_pTop20Caption->font(); qFont.setBold(true); qFont.setPointSize(10); m_pTop20Caption->setFont(qFont); pRightVLayout->addWidget(m_pTop20Caption); QStringList columnCaptions; columnCaptions << "#"; if (m_callType == API_CALL) { columnCaptions << GP_STR_SummaryTop20TableColumnThreadId; } columnCaptions << GP_STR_SummaryTop20TableColumnCallIndex; columnCaptions << GP_STR_SummaryTop20TableColumnTime; m_pTop20Table->initHeaders(columnCaptions, false); m_pTop20Table->setContextMenuPolicy(Qt::NoContextMenu); m_pTop20Table->resizeColumnsToContents(); m_pTop20Table->setShowGrid(true); pRightVLayout->addWidget(m_pTop20Table); pRightVLayout->setSpacing(1); pRightVLayout->setMargin(1); pWidgetRight->setLayout(pRightVLayout); pWidgetRight->setStyleSheet(styleSheetStr); pVMainSplitter->addWidget(pWidgetLeft); pVMainSplitter->addWidget(pWidgetRight); int widgetWidth = geometry().right() - geometry().left(); QList<int> sizes; sizes << (int)(widgetWidth * 0.75); sizes << (int)(widgetWidth * 0.25); pVMainSplitter->setSizes(sizes); pHLayout->addWidget(pVMainSplitter); setLayout(pHLayout); SetTimelineScope(false, timelineStart, timelineEnd); rc = connect(m_pChkboxUseScope, SIGNAL(toggled(bool)), this, SLOT(OnUseTimelineSelectionScopeChanged(bool))); GT_ASSERT(rc); rc = connect(m_pSummaryTable, SIGNAL(itemSelectionChanged()), this, SLOT(OnSummaryTableSelectionChanged())); GT_ASSERT(rc); rc = connect(m_pSummaryTable, SIGNAL(cellClicked(int, int)), this, SLOT(OnSummaryTableCellClicked(int, int))); GT_ASSERT(rc); rc = connect(m_pSummaryTable, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(OnSummaryTableCellDoubleClicked(int, int))); GT_ASSERT(rc); rc = connect(m_pTop20Table, SIGNAL(cellClicked(int, int)), this, SLOT(OnTop20TableCellClicked(int, int))); GT_ASSERT(rc); rc = connect(m_pTop20Table, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(OnTop20TableCellDoubleClicked(int, int))); GT_ASSERT(rc); m_pSummaryTable->selectRow(0); OnSummaryTableSelectionChanged(); // NZ for some reason the signal isn't enough }
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) : Tab(_tabSupervisor, parent), modified(false) { aClearSearch = new QAction(QString(), this); aClearSearch->setIcon(QIcon(":/resources/icon_clearsearch.svg")); connect(aClearSearch, SIGNAL(triggered()), this, SLOT(actClearSearch())); searchLabel = new QLabel(); searchEdit = new SearchLineEdit; searchLabel->setBuddy(searchEdit); setFocusProxy(searchEdit); setFocusPolicy(Qt::ClickFocus); searchEdit->installEventFilter(&searchKeySignals); connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &))); connect(&searchKeySignals, SIGNAL(onEnter()), this, SLOT(actAddCard())); connect(&searchKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actAddCard())); connect(&searchKeySignals, SIGNAL(onCtrlAltRBracket()), this, SLOT(actAddCardToSideboard())); connect(&searchKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrementCard())); connect(&searchKeySignals, SIGNAL(onCtrlAltLBracket()), this, SLOT(actDecrementCardFromSideboard())); connect(&searchKeySignals, SIGNAL(onCtrlAltEnter()), this, SLOT(actAddCardToSideboard())); connect(&searchKeySignals, SIGNAL(onCtrlEnter()), this, SLOT(actAddCardToSideboard())); QToolBar *deckEditToolBar = new QToolBar; deckEditToolBar->setOrientation(Qt::Horizontal); deckEditToolBar->setIconSize(QSize(24, 24)); QHBoxLayout *searchLayout = new QHBoxLayout; searchLayout->addWidget(deckEditToolBar); searchLayout->addWidget(searchLabel); searchLayout->addWidget(searchEdit); databaseModel = new CardDatabaseModel(db, this); databaseDisplayModel = new CardDatabaseDisplayModel(this); databaseDisplayModel->setSourceModel(databaseModel); databaseDisplayModel->setFilterKeyColumn(0); databaseDisplayModel->sort(0, Qt::AscendingOrder); databaseView = new QTreeView(); databaseView->setFocusProxy(searchEdit); databaseView->setModel(databaseDisplayModel); databaseView->setUniformRowHeights(true); databaseView->setRootIsDecorated(false); databaseView->setAlternatingRowColors(true); databaseView->setSortingEnabled(true); databaseView->sortByColumn(0, Qt::AscendingOrder); databaseView->resizeColumnToContents(0); connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &))); connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard())); searchEdit->setTreeView(databaseView); QVBoxLayout *leftFrame = new QVBoxLayout; leftFrame->addLayout(searchLayout); leftFrame->addWidget(databaseView); cardInfo = new CardFrame(250, 356); aCardTextOnly = new QAction(QString(), this); aCardTextOnly->setCheckable(true); connect(aCardTextOnly, SIGNAL(triggered()), cardInfo, SLOT(toggleCardTextOnly())); filterModel = new FilterTreeModel(); databaseDisplayModel->setFilterTree(filterModel->filterTree()); filterView = new QTreeView; filterView->setModel(filterModel); filterView->setMaximumWidth(250); filterView->setUniformRowHeights(true); filterView->setHeaderHidden(true); filterView->setContextMenuPolicy(Qt::CustomContextMenu); connect(filterModel, SIGNAL(layoutChanged()), filterView, SLOT(expandAll())); connect(filterView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(filterViewCustomContextMenu(const QPoint &))); FilterBuilder *filterBuilder = new FilterBuilder; filterBuilder->setMaximumWidth(250); connect(filterBuilder, SIGNAL(add(const CardFilter *)), filterModel, SLOT(addFilter(const CardFilter *))); QVBoxLayout *filter = new QVBoxLayout; filter->addWidget(filterBuilder, 0, Qt::AlignTop); filter->addWidget(filterView, 10); QVBoxLayout *middleFrame = new QVBoxLayout; middleFrame->addWidget(cardInfo, 0, Qt::AlignTop); middleFrame->addLayout(filter, 10); deckModel = new DeckListModel(this); connect(deckModel, SIGNAL(deckHashChanged()), this, SLOT(updateHash())); deckView = new QTreeView(); deckView->setModel(deckModel); deckView->setUniformRowHeights(true); deckView->setSortingEnabled(true); deckView->sortByColumn(1, Qt::AscendingOrder); #if QT_VERSION < 0x050000 deckView->header()->setResizeMode(QHeaderView::ResizeToContents); #else deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); #endif deckView->installEventFilter(&deckViewKeySignals); connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &))); connect(&deckViewKeySignals, SIGNAL(onEnter()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrement())); connect(&deckViewKeySignals, SIGNAL(onRight()), this, SLOT(actIncrement())); connect(&deckViewKeySignals, SIGNAL(onLeft()), this, SLOT(actDecrement())); connect(&deckViewKeySignals, SIGNAL(onDelete()), this, SLOT(actRemoveCard())); nameLabel = new QLabel(); nameEdit = new QLineEdit; nameLabel->setBuddy(nameEdit); connect(nameEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateName(const QString &))); commentsLabel = new QLabel(); commentsEdit = new QTextEdit; commentsEdit->setMaximumHeight(70); commentsLabel->setBuddy(commentsEdit); connect(commentsEdit, SIGNAL(textChanged()), this, SLOT(updateComments())); hashLabel1 = new QLabel(); hashLabel = new QLabel; QGridLayout *grid = new QGridLayout; grid->addWidget(nameLabel, 0, 0); grid->addWidget(nameEdit, 0, 1); grid->addWidget(commentsLabel, 1, 0); grid->addWidget(commentsEdit, 1, 1); grid->addWidget(hashLabel1, 2, 0); grid->addWidget(hashLabel, 2, 1); // Update price aUpdatePrices = new QAction(QString(), this); aUpdatePrices->setIcon(QIcon(":/resources/icon_update.png")); connect(aUpdatePrices, SIGNAL(triggered()), this, SLOT(actUpdatePrices())); if (!settingsCache->getPriceTagFeature()) aUpdatePrices->setVisible(false); connect(settingsCache, SIGNAL(priceTagFeatureChanged(int)), this, SLOT(setPriceTagFeatureEnabled(int))); QToolBar *deckToolBar = new QToolBar; deckToolBar->setOrientation(Qt::Vertical); deckToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); deckToolBar->setIconSize(QSize(24, 24)); deckToolBar->addAction(aUpdatePrices); QHBoxLayout *deckToolbarLayout = new QHBoxLayout; deckToolbarLayout->addStretch(); deckToolbarLayout->addWidget(deckToolBar); deckToolbarLayout->addStretch(); QVBoxLayout *rightFrame = new QVBoxLayout; rightFrame->addLayout(grid); rightFrame->addWidget(deckView, 10); rightFrame->addLayout(deckToolbarLayout); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addLayout(leftFrame, 10); mainLayout->addLayout(middleFrame); mainLayout->addLayout(rightFrame); setLayout(mainLayout); aNewDeck = new QAction(QString(), this); aNewDeck->setShortcuts(QKeySequence::New); connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck())); aLoadDeck = new QAction(QString(), this); aLoadDeck->setShortcuts(QKeySequence::Open); connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck())); aSaveDeck = new QAction(QString(), this); aSaveDeck->setShortcuts(QKeySequence::Save); connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck())); aSaveDeckAs = new QAction(QString(), this); // aSaveDeckAs->setShortcuts(QKeySequence::SaveAs); connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs())); aLoadDeckFromClipboard = new QAction(QString(), this); connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard())); aLoadDeckFromClipboard->setShortcuts(QKeySequence::Paste); aSaveDeckToClipboard = new QAction(QString(), this); connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard())); aSaveDeckToClipboard->setShortcuts(QKeySequence::Copy); aPrintDeck = new QAction(QString(), this); aPrintDeck->setShortcuts(QKeySequence::Print); connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck())); aAnalyzeDeck = new QAction(QString(), this); connect(aAnalyzeDeck, SIGNAL(triggered()), this, SLOT(actAnalyzeDeck())); aClose = new QAction(QString(), this); connect(aClose, SIGNAL(triggered()), this, SLOT(closeRequest())); aEditSets = new QAction(QString(), this); connect(aEditSets, SIGNAL(triggered()), this, SLOT(actEditSets())); aEditTokens = new QAction(QString(), this); connect(aEditTokens, SIGNAL(triggered()), this, SLOT(actEditTokens())); deckMenu = new QMenu(this); deckMenu->addAction(aNewDeck); deckMenu->addAction(aLoadDeck); deckMenu->addAction(aSaveDeck); deckMenu->addAction(aSaveDeckAs); deckMenu->addSeparator(); deckMenu->addAction(aLoadDeckFromClipboard); deckMenu->addAction(aSaveDeckToClipboard); deckMenu->addSeparator(); deckMenu->addAction(aPrintDeck); deckMenu->addSeparator(); deckMenu->addAction(aAnalyzeDeck); deckMenu->addSeparator(); deckMenu->addAction(aClose); addTabMenu(deckMenu); dbMenu = new QMenu(this); dbMenu->addAction(aEditSets); dbMenu->addAction(aEditTokens); dbMenu->addSeparator(); dbMenu->addAction(aClearSearch); dbMenu->addAction(aCardTextOnly); addTabMenu(dbMenu); aAddCard = new QAction(QString(), this); aAddCard->setIcon(QIcon(":/resources/arrow_right_green.svg")); connect(aAddCard, SIGNAL(triggered()), this, SLOT(actAddCard())); aAddCardToSideboard = new QAction(QString(), this); aAddCardToSideboard->setIcon(QIcon(":/resources/add_to_sideboard.svg")); connect(aAddCardToSideboard, SIGNAL(triggered()), this, SLOT(actAddCardToSideboard())); aRemoveCard = new QAction(QString(), this); aRemoveCard->setIcon(QIcon(":/resources/remove_row.svg")); connect(aRemoveCard, SIGNAL(triggered()), this, SLOT(actRemoveCard())); aIncrement = new QAction(QString(), this); aIncrement->setIcon(QIcon(":/resources/increment.svg")); connect(aIncrement, SIGNAL(triggered()), this, SLOT(actIncrement())); aDecrement = new QAction(QString(), this); aDecrement->setIcon(QIcon(":/resources/decrement.svg")); connect(aDecrement, SIGNAL(triggered()), this, SLOT(actDecrement())); deckEditToolBar->addAction(aAddCard); deckEditToolBar->addAction(aAddCardToSideboard); deckEditToolBar->addAction(aRemoveCard); deckEditToolBar->addAction(aIncrement); deckEditToolBar->addAction(aDecrement); deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); retranslateUi(); resize(950, 700); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); { //! [0] QWidget *window = new QWidget; //! [0] //! [1] QPushButton *button1 = new QPushButton("One"); //! [1] //! [2] QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); //! [2] //! [3] QHBoxLayout *layout = new QHBoxLayout; //! [3] //! [4] layout->addWidget(button1); layout->addWidget(button2); layout->addWidget(button3); layout->addWidget(button4); layout->addWidget(button5); window->setLayout(layout); //! [4] window->setWindowTitle("QHBoxLayout"); //! [5] window->show(); //! [5] } { //! [6] QWidget *window = new QWidget; //! [6] //! [7] QPushButton *button1 = new QPushButton("One"); //! [7] //! [8] QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); //! [8] //! [9] QVBoxLayout *layout = new QVBoxLayout; //! [9] //! [10] layout->addWidget(button1); layout->addWidget(button2); layout->addWidget(button3); layout->addWidget(button4); layout->addWidget(button5); window->setLayout(layout); //! [10] window->setWindowTitle("QVBoxLayout"); //! [11] window->show(); //! [11] } { //! [12] QWidget *window = new QWidget; //! [12] //! [13] QPushButton *button1 = new QPushButton("One"); //! [13] //! [14] QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); //! [14] //! [15] QGridLayout *layout = new QGridLayout; //! [15] //! [16] layout->addWidget(button1, 0, 0); layout->addWidget(button2, 0, 1); layout->addWidget(button3, 1, 0, 1, 2); layout->addWidget(button4, 2, 0); layout->addWidget(button5, 2, 1); window->setLayout(layout); //! [16] window->setWindowTitle("QGridLayout"); //! [17] window->show(); //! [17] } { //! [18] QWidget *window = new QWidget; //! [18] //! [19] QPushButton *button1 = new QPushButton("One"); QLineEdit *lineEdit1 = new QLineEdit(); //! [19] //! [20] QPushButton *button2 = new QPushButton("Two"); QLineEdit *lineEdit2 = new QLineEdit(); QPushButton *button3 = new QPushButton("Three"); QLineEdit *lineEdit3 = new QLineEdit(); //! [20] //! [21] QFormLayout *layout = new QFormLayout; //! [21] //! [22] layout->addRow(button1, lineEdit1); layout->addRow(button2, lineEdit2); layout->addRow(button3, lineEdit3); window->setLayout(layout); //! [22] window->setWindowTitle("QFormLayout"); //! [23] window->show(); //! [23] } { //! [24] QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(formWidget); setLayout(layout); //! [24] } return app.exec(); }
void SampleView::setupMainLayout(){ // Create QListView object and associate it with the sample model. sampleListView_ = new QListView(); sampleListView_->setModel(sampleModel_); // Prevent user from editing the text within the view. sampleListView_->setEditTriggers(0); // Set view to display column 4 (index 3) of the model, the sample title. sampleListView_->setModelColumn(3); // Sample list and it's groupbox layout setup. sampleListGroupBox_ = new QGroupBox("Samples"); sampleListLayout_ = new QVBoxLayout; sampleListLayout_->addWidget(sampleListView_); sampleListGroupBox_->setLayout(sampleListLayout_); nameLabel_ = new QLabel("Sample Name: "); nameEdit_ = new QLineEdit(); chemLabel_ = new QLabel("Chemical Symbol: "); chemEdit_ = new QLineEdit(); notesLabel_ = new QLabel("Notes: "); notesEdit_ = new QTextEdit(); addSampleButton_ = new QPushButton("Add Sample"); removeSampleButton_ = new QPushButton("Remove Sample"); // Setup QDataWidgetMapper. Set approrpite UI elements to their respective rows in sample model. // Set the widgets to display the first sample. modelToWidgetMapper_ = new QDataWidgetMapper(this); modelToWidgetMapper_->setModel(sampleModel_); modelToWidgetMapper_->addMapping(nameEdit_, 0); modelToWidgetMapper_->addMapping(chemEdit_, 1); modelToWidgetMapper_->addMapping(notesEdit_, 2); modelToWidgetMapper_->toFirst(); //Master layout sampleWidgetLayout_ = new QHBoxLayout(); //Sample sub-layout sampleNameLayout_ = new QHBoxLayout(); sampleChemLayout_ = new QHBoxLayout(); sampleNotesLayout_ = new QHBoxLayout(); sampleInfoLayout_ = new QVBoxLayout(); addRemoveButtonLayout_ = new QHBoxLayout(); //Add widgets to appropriate layouts sampleNameLayout_->addWidget(nameLabel_); sampleNameLayout_->addWidget(nameEdit_); sampleChemLayout_->addWidget(chemLabel_); sampleChemLayout_->addWidget(chemEdit_); sampleNotesLayout_->addWidget(notesLabel_); sampleNotesLayout_->addWidget(notesEdit_); addRemoveButtonLayout_->addWidget(addSampleButton_); addRemoveButtonLayout_->addWidget(removeSampleButton_); sampleInfoLayout_->addLayout(sampleNameLayout_); sampleInfoLayout_->addLayout(sampleChemLayout_); sampleInfoLayout_->addLayout(sampleNotesLayout_); sampleInfoLayout_->addLayout(addRemoveButtonLayout_); //Setup master layout sampleWidgetLayout_->addLayout(sampleInfoLayout_); sampleWidgetLayout_->addSpacing(10); sampleWidgetLayout_->addWidget(sampleListGroupBox_); setLayout(sampleWidgetLayout_); }
void ScriptDialogWidget::InitWindow(ScriptDialogRequest &request) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(0); layout->setMargin(0); setLayout(layout); QUiLoader loader; QFile file("./data/ui/scriptdialog.ui"); if (!file.exists()) { // TODO: LogError ("Cannot find ScriptDialog.ui file."); return; } // Get pointers to widgets. widget_ = loader.load(&file, 0); file.close(); layout->addWidget(widget_); QPlainTextEdit* message_text = widget_->findChild<QPlainTextEdit*>("messageText"); if (message_text) message_text->appendPlainText( QString::fromUtf8(request_.GetMessageText().c_str(), request_.GetMessageText().size()) ); QLabel* from_text = widget_->findChild<QLabel*>("fromText"); if (from_text) from_text->setText( QString( request_.GetObjectName().c_str()) ); QLabel* owner_text = widget_->findChild<QLabel*>("ownerText"); if (owner_text) owner_text->setText( QString(request_.GetObjectsOwnerName().c_str()) ); ButtonLabels labels = request.GetButtonLabels(); QGridLayout* button_container = widget_->findChild<QGridLayout*>("dynamicButtonsContainer"); if (!button_container) { // todo: LogError: "Cannot show buttons on ScriptDialogWidget, button container pointer not valid." return; } //button_container->setColumnCount(3); //button_container->setRowCount((labels.size()-1) / 3 + 1); int index = 0; for (ButtonLabels::iterator i = labels.begin(); i != labels.end(); ++i) { QString label = QString((*i).c_str()); SelectionButton* button = new SelectionButton(0, label.toStdString().c_str(), label); int column = index % 3; int row = index / 3; button_container->addWidget(button, row, column); connect(button, SIGNAL( Clicked(QString)), this, SLOT( OnButtonPressed(QString))); index++; } QPushButton* default_button = widget_->findChild<QPushButton*>("defaultButton"); if (default_button) { if (labels.size() == 0) { SelectionButton* button = new SelectionButton(0, "Ok", "Ok"); button_container->addWidget(button, 0, 0); connect(button, SIGNAL( Clicked(QString)), this, SLOT( OnButtonPressed(QString))); } else { default_button->setText("Ignore"); connect(default_button, SIGNAL( clicked()), this, SLOT( OnIgnorePressed()) ); } } }
QgsRelationEditorWidget::QgsRelationEditorWidget( QWidget* parent ) : QgsCollapsibleGroupBox( parent ) , mViewMode( QgsDualView::AttributeEditor ) , mVisible( false ) { QVBoxLayout* topLayout = new QVBoxLayout( this ); topLayout->setContentsMargins( 0, 9, 0, 0 ); setLayout( topLayout ); // buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setContentsMargins( 0, 0, 0, 0 ); // toogle editing mToggleEditingButton = new QToolButton( this ); mToggleEditingButton->setObjectName( "mToggleEditingButton" ); mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.svg" ) ); mToggleEditingButton->setText( tr( "Toggle editing" ) ); mToggleEditingButton->setEnabled( false ); mToggleEditingButton->setCheckable( true ); mToggleEditingButton->setToolTip( tr( "Toggle editing mode for child layer" ) ); buttonLayout->addWidget( mToggleEditingButton ); // save Edits mSaveEditsButton = new QToolButton( this ); mSaveEditsButton->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.svg" ) ); mSaveEditsButton->setText( tr( "Save child layer edits" ) ); mSaveEditsButton->setToolTip( tr( "Save child layer edits" ) ); mSaveEditsButton->setEnabled( true ); buttonLayout->addWidget( mSaveEditsButton ); // add feature mAddFeatureButton = new QToolButton( this ); mAddFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.svg" ) ); mAddFeatureButton->setText( tr( "Add child feature" ) ); mAddFeatureButton->setToolTip( tr( "Add child feature" ) ); mAddFeatureButton->setObjectName( "mAddFeatureButton" ); buttonLayout->addWidget( mAddFeatureButton ); // delete feature mDeleteFeatureButton = new QToolButton( this ); mDeleteFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.svg" ) ); mDeleteFeatureButton->setText( tr( "Delete child feature" ) ); mDeleteFeatureButton->setToolTip( tr( "Delete child feature" ) ); mDeleteFeatureButton->setObjectName( "mDeleteFeatureButton" ); buttonLayout->addWidget( mDeleteFeatureButton ); // link feature mLinkFeatureButton = new QToolButton( this ); mLinkFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionLink.svg" ) ); mLinkFeatureButton->setText( tr( "Link existing features" ) ); mLinkFeatureButton->setToolTip( tr( "Link existing child features" ) ); mLinkFeatureButton->setObjectName( "mLinkFeatureButton" ); buttonLayout->addWidget( mLinkFeatureButton ); // unlink feature mUnlinkFeatureButton = new QToolButton( this ); mUnlinkFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionUnlink.svg" ) ); mUnlinkFeatureButton->setText( tr( "Unlink feature" ) ); mUnlinkFeatureButton->setToolTip( tr( "Unlink child feature" ) ); mUnlinkFeatureButton->setObjectName( "mUnlinkFeatureButton" ); buttonLayout->addWidget( mUnlinkFeatureButton ); // spacer buttonLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding ) ); // form view mFormViewButton = new QToolButton( this ); mFormViewButton->setText( tr( "Form view" ) ); mFormViewButton->setToolTip( tr( "Switch to form view" ) ); mFormViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionPropertyItem.png" ) ); mFormViewButton->setCheckable( true ); mFormViewButton->setChecked( mViewMode == QgsDualView::AttributeEditor ); buttonLayout->addWidget( mFormViewButton ); // table view mTableViewButton = new QToolButton( this ); mTableViewButton->setText( tr( "Table view" ) ); mTableViewButton->setToolTip( tr( "Switch to table view" ) ); mTableViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.svg" ) ); mTableViewButton->setCheckable( true ); mTableViewButton->setChecked( mViewMode == QgsDualView::AttributeTable ); buttonLayout->addWidget( mTableViewButton ); // button group mViewModeButtonGroup = new QButtonGroup( this ); mViewModeButtonGroup->addButton( mFormViewButton, QgsDualView::AttributeEditor ); mViewModeButtonGroup->addButton( mTableViewButton, QgsDualView::AttributeTable ); // add buttons layout topLayout->addLayout( buttonLayout ); mRelationLayout = new QGridLayout(); mRelationLayout->setContentsMargins( 0, 0, 0, 0 ); topLayout->addLayout( mRelationLayout ); mDualView = new QgsDualView( this ); mDualView->setView( mViewMode ); mFeatureSelectionMgr = new QgsGenericFeatureSelectionManager( mDualView ); mDualView->setFeatureSelectionManager( mFeatureSelectionMgr ); mRelationLayout->addWidget( mDualView ); connect( this, SIGNAL( collapsedStateChanged( bool ) ), this, SLOT( onCollapsedStateChanged( bool ) ) ); connect( mViewModeButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( setViewMode( int ) ) ); connect( mToggleEditingButton, SIGNAL( clicked( bool ) ), this, SLOT( toggleEditing( bool ) ) ); connect( mSaveEditsButton, SIGNAL( clicked() ), this, SLOT( saveEdits() ) ); connect( mAddFeatureButton, SIGNAL( clicked() ), this, SLOT( addFeature() ) ); connect( mDeleteFeatureButton, SIGNAL( clicked() ), this, SLOT( deleteFeature() ) ); connect( mLinkFeatureButton, SIGNAL( clicked() ), this, SLOT( linkFeature() ) ); connect( mUnlinkFeatureButton, SIGNAL( clicked() ), this, SLOT( unlinkFeature() ) ); connect( mFeatureSelectionMgr, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( updateButtons() ) ); // Set initial state for add/remove etc. buttons updateButtons(); }
HumbleLogin_t::HumbleLogin_t( ) : QDialog() { _browser = nullptr; QVBoxLayout* main_layout = new QVBoxLayout( this ); _un_label = new QLabel( tr("Username:"******"Password:"******"Captcha"), this ); _captcha_label = new QLabel( this ); _captcha_response = new QLineEdit( this ); _ok_button = new QPushButton( tr("&Login"),this ); _exit_button = new QPushButton( tr("&Cancel"),this ); QGroupBox* issues_box = new QGroupBox( tr("Account issues"),this ); _register_label = new QLabel( tr("No Account?"),this ); _register_button= new QPushButton( tr("&Register new account"),this ); _newpw_label = new QLabel( tr("Forgot password?"),this ); _newpw_button = new QPushButton( tr("Request &new password"),this ); _weblogin_label = new QLabel( tr("Still trouble loggin in?"),this ); _weblogin_button= new QPushButton( tr("Login via &website"),this ); //Credentials: Login,Cancel + coresponding linedits/labels QGridLayout* cred_layout = new QGridLayout(); QHBoxLayout* button_layout = new QHBoxLayout(); cred_layout->addWidget( _un_label,1,1 ); cred_layout->addWidget( _pw_label,2,1 ); cred_layout->addWidget( _un_combo,1,2 ); cred_layout->addWidget( _pw_edit, 2,2 ); button_layout->addItem( new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum) ); button_layout->addWidget( _ok_button ); button_layout->addWidget( _exit_button); button_layout->addItem( new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum) ); //Captcha captcha_layout->addWidget( _captcha_label ); captcha_layout->addWidget( _captcha_response ); _captcha_box->setLayout( captcha_layout ); //Issues Box: QGridLayout* issues_layout = new QGridLayout(); issues_layout->addWidget( _register_label, 1,1 ); issues_layout->addWidget( _newpw_label , 2,1 ); issues_layout->addWidget( _weblogin_label, 3,1 ); issues_layout->addWidget( _register_button,1,2 ); issues_layout->addWidget( _newpw_button ,2,2 ); issues_layout->addWidget( _weblogin_button,3,2 ); issues_box->setLayout( issues_layout ); //Bring it all together main_layout->addLayout( cred_layout ); main_layout->addWidget( _captcha_box ); main_layout->addLayout( button_layout); main_layout->addWidget( issues_box ); main_layout->addItem( new QSpacerItem(0,0,QSizePolicy::Minimum,QSizePolicy::Expanding) ); setLayout( main_layout ); //Add functionality _register_label->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); _newpw_label->setAlignment ( Qt::AlignRight | Qt::AlignVCenter ); _weblogin_label->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); main_layout->setSizeConstraint( QLayout::SetFixedSize ); _un_combo->setEditable( true ); for ( QString user : HumbleUserData_t::instance().knownUsers() ) _un_combo->addItem( user ); _pw_edit->setEchoMode( QLineEdit::Password ); connect( _exit_button,&QPushButton::clicked, this,&HumbleLogin_t::close ); connect( _ok_button, &QPushButton::clicked, [=] () { emit credentialsReady( username(),_pw_edit->text(),_captcha_response->text() ); // _pw_edit->setText(""); //TODO: Do it when login was sucessful! }); connect( _register_button,&QPushButton::clicked, this, &HumbleLogin_t::solveIssueRegister ); connect( _newpw_button ,&QPushButton::clicked, this, &HumbleLogin_t::solveIssuePassword ); connect( _weblogin_button,&QPushButton::clicked, this, &HumbleLogin_t::solveIssueWeblogin ); setCaptcha( QPixmap() ); }
HighScoreWindow::HighScoreWindow(QWidget *parent) : QDialog(parent){ // Sets up the database connectivity QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "defaultConn"); // Testing on local... //db.setHostName("localhost"); //db.setDatabaseName("test"); //db.setUserName("root"); //db.setPassword("---"); // Class connection... db.setHostName("209.129.8.5"); db.setPort(3306); db.setDatabaseName("48597"); db.setUserName("48597"); db.setPassword("48597csc17b"); // Holds the info for the query set up QString queryText = "SELECT `entity_user_guesswho`.`username`, `entity_results_guesswho`.`turns_used`, `entity_results_guesswho`.`date_time` FROM" "`48597`.`xref_user_results_guesswho` AS `xref_user_results_guesswho`, `48597`.`entity_results_guesswho` AS `entity_results_guesswho`, " "`48597`.`entity_user_guesswho` AS `entity_user_guesswho` WHERE `xref_user_results_guesswho`.`result_id` = `entity_results_guesswho`.`result_id`" "AND `xref_user_results_guesswho`.`player_id` = `entity_user_guesswho`.`player_id` ORDER BY `entity_results_guesswho`.`turns_used` ASC"; // Sets up a table widget for the database scores scoreTable = new QTableWidget(this); scoreTable->setColumnCount(3); scoreTableHeader << "Rank" << "Alias" << "Turns Taken"; scoreTable->setHorizontalHeaderLabels(scoreTableHeader); scoreTable->verticalHeader()->setVisible(false); scoreTable->setFixedSize(300, 342); if (db.open()){ qDebug() << "Opened Database"; QSqlQuery *query = new QSqlQuery(QSqlDatabase::database("defaultConn")); int row = 0; // Uses a query to grab info from DB tables and store them onto the table's fields if (query->exec(""+queryText+"")){ while (query->next() && row < 10){ scoreTable->setRowCount(row + 1); // Stores ranking, name, and score info into their respective fields QStringList fields; fields << QString::number(row + 1) << query->value(0).toString() << query->value(1).toString(); for (int j = 0; j < fields.count(); j++){ scoreTable->setItem(row, j, new QTableWidgetItem(fields[j])); } row++; } } } else{ qDebug() << "Error: " << db.lastError().text(); } // Creates a button box with an Ok & Cancel button buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); // Refreshes the table scoreTable->viewport()->update(); // Creates the layout for the High Score window QVBoxLayout *layout = new QVBoxLayout; layout->addSpacing(20); layout->addWidget(scoreTable, 3, Qt::AlignHCenter); layout->addWidget(buttonBox, 1, Qt::AlignBottom); setLayout(layout); // Sets the title of the High Score window setWindowTitle(tr("High Scores")); setFixedSize(400,440); db.close(); }
void WindowMaterialGlazingInspectorView::createLayout() { auto hiddenWidget = new QWidget(); this->stackedWidget()->addWidget(hiddenWidget); auto visibleWidget = new QWidget(); this->stackedWidget()->addWidget(visibleWidget); auto mainGridLayout = new QGridLayout(); mainGridLayout->setContentsMargins(7, 7, 7, 7); mainGridLayout->setSpacing(14); visibleWidget->setLayout(mainGridLayout); int row = mainGridLayout->rowCount(); QLabel * label = nullptr; // Name label = new QLabel("Name: "); label->setObjectName("H2"); mainGridLayout->addWidget(label, row, 0); ++row; m_nameEdit = new OSLineEdit(); mainGridLayout->addWidget(m_nameEdit, row, 0, 1, 3); ++row; // Standards Information m_standardsInformationWidget = new StandardsInformationMaterialWidget(m_isIP, mainGridLayout, row); ++row; // Optical Data Type label = new QLabel("Optical Data Type: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_opticalDataType = new OSComboBox(); m_opticalDataType->addItem("Spectral Average"); m_opticalDataType->addItem("Spectral"); mainGridLayout->addWidget(m_opticalDataType,row++,0,1,3); // Window Glass Spectral Data Set Name label = new QLabel("Window Glass Spectral Data Set Name: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_windowGlassSpectralDataSetName = new OSLineEdit(); mainGridLayout->addWidget(m_windowGlassSpectralDataSetName,row++,0,1,3); // Thickness label = new QLabel("Thickness: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_thickness = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_thickness, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_thickness,row++,0,1,3); // Solar Transmittance At Normal Incidence label = new QLabel("Solar Transmittance At Normal Incidence: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_solarTransmittanceAtNormalIncidence = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_solarTransmittanceAtNormalIncidence, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_solarTransmittanceAtNormalIncidence,row++,0,1,3); // Front Side Solar Reflectance At Normal Incidence label = new QLabel("Front Side Solar Reflectance At Normal Incidence: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_frontSideSolarReflectanceAtNormalIncidence = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_frontSideSolarReflectanceAtNormalIncidence, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_frontSideSolarReflectanceAtNormalIncidence,row++,0,1,3); // Back Side Solar Reflectance At Normal Incidence label = new QLabel("Back Side Solar Reflectance At Normal Incidence: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_backSideSolarReflectanceAtNormalIncidence = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_backSideSolarReflectanceAtNormalIncidence, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_backSideSolarReflectanceAtNormalIncidence,row++,0,1,3); // Visible Transmittance At Normal Incidence label = new QLabel("Visible Transmittance At Normal Incidence: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_visibleTransmittanceAtNormalIncidence = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_visibleTransmittanceAtNormalIncidence, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_visibleTransmittanceAtNormalIncidence,row++,0,1,3); // Front Side Visible Reflectance At Normal Incidence label = new QLabel("Front Side Visible Reflectance At Normal Incidence: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_frontSideVisibleReflectanceAtNormalIncidence = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_frontSideVisibleReflectanceAtNormalIncidence, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_frontSideVisibleReflectanceAtNormalIncidence,row++,0,1,3); // Back Side Visible Reflectance At Normal Incidence label = new QLabel("Back Side Visible Reflectance At Normal Incidence: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_backSideVisibleReflectanceAtNormalIncidence = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_backSideVisibleReflectanceAtNormalIncidence, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_backSideVisibleReflectanceAtNormalIncidence,row++,0,1,3); // Infrared Transmittance at Normal Incidence label = new QLabel("Infrared Transmittance at Normal Incidence: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_infraredTransmittanceAtNormalIncidence = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_infraredTransmittanceAtNormalIncidence, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_infraredTransmittanceAtNormalIncidence,row++,0,1,3); // Front Side Infrared Hemispherical Emissivity label = new QLabel("Front Side Infrared Hemispherical Emissivity: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_frontSideInfraredHemisphericalEmissivity = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_frontSideInfraredHemisphericalEmissivity, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_frontSideInfraredHemisphericalEmissivity,row++,0,1,3); // Back Side Infrared Hemispherical Emissivity label = new QLabel("Back Side Infrared Hemispherical Emissivity: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_backSideInfraredHemisphericalEmissivity = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_backSideInfraredHemisphericalEmissivity, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_backSideInfraredHemisphericalEmissivity,row++,0,1,3); // Conductivity label = new QLabel("Conductivity: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_conductivity = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_conductivity, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_conductivity,row++,0,1,3); // Dirt Correction Factor For Solar And Visible Transmittance label = new QLabel("Dirt Correction Factor For Solar And Visible Transmittance: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_dirtCorrectionFactorForSolarAndVisibleTransmittance = new OSQuantityEdit(m_isIP); connect(this, &WindowMaterialGlazingInspectorView::toggleUnitsClicked, m_dirtCorrectionFactorForSolarAndVisibleTransmittance, &OSQuantityEdit::onUnitSystemChange); mainGridLayout->addWidget(m_dirtCorrectionFactorForSolarAndVisibleTransmittance,row++,0,1,3); // Solar Diffusing label = new QLabel("Solar Diffusing: "); label->setObjectName("H2"); mainGridLayout->addWidget(label,row++,0); m_solarDiffusing = new OSSwitch(); mainGridLayout->addWidget(m_solarDiffusing,row++,0,1,3); // Stretch mainGridLayout->setRowStretch(100,100); mainGridLayout->setColumnStretch(100,100); }
//----------------------------------------------------------------------------- //! Constructor for a dialog //----------------------------------------------------------------------------- tAutopilotAdvancedDialog::tAutopilotAdvancedDialog( tPilotController& pilotDevice, QWidget* pParent ) : tSaveCancelDialog( tDialog::Full, pParent ) , m_PilotDevice(pilotDevice) { setWindowTitle( tr( "Advanced" ) ); tPilotH5000AdvancedInterface::tH5000AdvancedParameters h5000AdvancedParameters; m_PilotDevice.GetH5000AdvancedInterface()->GetH5000AdvancedParameters( &h5000AdvancedParameters ); // Gust response tLabel* pGustResponseLbl = new tLabel( QString( tr( "Gust response" ) ), this ); // Gust response - enable tLabel* pGustResponseEnableLbl = new tLabel( QString( tr( "Enable" ) ), this ); m_pGustResponseCheck = new tCheckBox( false, this ); m_pGustResponseCheck->setChecked( h5000AdvancedParameters.gustResponse ); Connect( m_pGustResponseCheck, SIGNAL( toggled( bool ) ), this, SLOT( OnGustResponseEnableChanged( bool ) ) ); // Gust response - Gust MIN tLabel* pGustMinLbl = new tLabel( QString( tr( "Gust MIN" ) ), this ); m_pGustMinEdit = new tIntEdit( h5000AdvancedParameters.gustMin, 1, 10, this ); m_pGustMinEdit->setFixedWidth( 100 ); m_pGustMinEdit->setEnabled( m_pGustResponseCheck->isChecked() ); Connect( m_pGustMinEdit, SIGNAL( EditingFinished( int ) ), this, SLOT( OnEdit() ) ); // Gust response - Response rate tLabel* pGuestResponseRateLbl = new tLabel( QString( tr( "Response rate" ) ), this ); m_pGustResponseRateEdit = new tIntEdit( h5000AdvancedParameters.gustResponseRate, 1, 10, this ); m_pGustResponseRateEdit->setFixedWidth( 100 ); m_pGustResponseRateEdit->setEnabled( m_pGustResponseCheck->isChecked() ); Connect( m_pGustResponseRateEdit, SIGNAL( EditingFinished( int ) ), this, SLOT( OnEdit() ) ); // Gust response - TWA response tLabel* pTWAResponseLbl = new tLabel( QString( tr( "TWA response" ) ), this ); m_pTWAReponseEdit = new tDoubleEdit( h5000AdvancedParameters.TWAResponse, 1.0F, 5.0F, 1, this ); m_pTWAReponseEdit->setFixedWidth( 100 ); m_pTWAReponseEdit->setEnabled( m_pGustResponseCheck->isChecked() ); Connect( m_pTWAReponseEdit, SIGNAL( EditingFinished() ), this, SLOT( OnEdit() ) ); // TWS response tLabel* pTWSResponseLbl = new tLabel( QString( tr( "TWS response" ) ), this ); // TWS response - enable tLabel* pTWSResponseEnableLbl = new tLabel( QString( tr( "Enable" ) ), this ); m_pTWSCheck = new tCheckBox( false, this ); m_pTWSCheck->setChecked( h5000AdvancedParameters.TWSResponse ); Connect( m_pTWSCheck, SIGNAL( toggled( bool ) ), this, SLOT( OnTWSResponseEnableChanged( bool ) ) ); // TWS response - Response rate tLabel* pTWSResponseRateLbl = new tLabel( QString( tr( "Response rate" ) ), this ); m_pTWSResponseRateEdit = new tIntEdit( h5000AdvancedParameters.TWSResponseRate, 1, 10, this ); m_pTWSResponseRateEdit->setFixedWidth( 100 ); m_pTWSResponseRateEdit->setEnabled( m_pTWSCheck->isChecked() ); Connect( m_pTWSResponseRateEdit, SIGNAL( EditingFinished( int ) ), this, SLOT( OnEdit() ) ); // Heel compensation tLabel* pHeelCompensationLbl = new tLabel( QString( tr( "Heel compensation" ) ), this ); // Heel compensation - enable tLabel* pHeelCompensationEnableLbl = new tLabel( QString( tr( "Enable" ) ), this ); m_pHeelCompensationCheck = new tCheckBox( false, this ); m_pHeelCompensationCheck->setChecked( h5000AdvancedParameters.heelCompensation ); Connect( m_pHeelCompensationCheck, SIGNAL( toggled( bool ) ), this, SLOT( OnHeelCompensationEnableChanged( bool ) ) ); // Heel compensation - Response rate tLabel* pHeelCompensationResponseRateLbl = new tLabel( QString( tr( "Response rate" ) ), this ); m_pHeelCompensationResponseRateEdit = new tIntEdit( h5000AdvancedParameters.heelCompensationRate, 1, 10, this ); m_pHeelCompensationResponseRateEdit->setFixedWidth( 100 ); m_pHeelCompensationResponseRateEdit->setEnabled( m_pHeelCompensationCheck->isChecked() ); Connect( m_pHeelCompensationResponseRateEdit, SIGNAL( EditingFinished( int ) ), this, SLOT( OnEdit() ) ); int row( 0 ); QGridLayout* pGridLayout = new QGridLayout( this ); // Gust response pGridLayout->addWidget( pGustResponseLbl, row++, 0 ); pGridLayout->addWidget( pGustResponseEnableLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pGustResponseCheck, row++, 1 ); pGridLayout->addWidget( pGustMinLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pGustMinEdit, row++, 1 ); pGridLayout->addWidget( pGuestResponseRateLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pGustResponseRateEdit, row++, 1 ); pGridLayout->addWidget( pTWAResponseLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pTWAReponseEdit, row++, 1 ); // TWS response pGridLayout->addWidget( pTWSResponseLbl, row++, 0 ); pGridLayout->addWidget( pTWSResponseEnableLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pTWSCheck, row++, 1 ); pGridLayout->addWidget( pTWSResponseRateLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pTWSResponseRateEdit, row++, 1 ); // Heel compensation pGridLayout->addWidget( pHeelCompensationLbl, row++, 0 ); pGridLayout->addWidget( pHeelCompensationEnableLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pHeelCompensationCheck, row++, 1 ); pGridLayout->addWidget( pHeelCompensationResponseRateLbl, row, 0, Qt::AlignRight ); pGridLayout->addWidget( m_pHeelCompensationResponseRateEdit, row++, 1 ); setLayout( pGridLayout ); m_pGustResponseCheck->setFocus(); Connect ( m_PilotDevice.GetH5000AdvancedInterface(), SIGNAL( H5000AdvancedParametersChanged( tPilotH5000AdvancedInterface::tH5000AdvancedParameters ) ), this, SLOT( OnH5000AdvancedParametersChanged( tPilotH5000AdvancedInterface::tH5000AdvancedParameters ) ) ); }
FenPrincipale::FenPrincipale() { // Groupe : Définition de la classe nom = new QLineEdit; classeMere = new QLineEdit; QFormLayout *definitionLayout = new QFormLayout; definitionLayout->addRow("&Nom :", nom); definitionLayout->addRow("Classe &mère :", classeMere); QGroupBox *groupDefinition = new QGroupBox("Définition de la classe"); groupDefinition->setLayout(definitionLayout); // Groupe : Options protections = new QCheckBox("Protéger le &header contre les inclusions multiples"); protections->setChecked(true); genererConstructeur = new QCheckBox("Générer un &constructeur par défaut"); genererDestructeur = new QCheckBox("Générer un &destructeur"); QVBoxLayout *optionsLayout = new QVBoxLayout; optionsLayout->addWidget(protections); optionsLayout->addWidget(genererConstructeur); optionsLayout->addWidget(genererDestructeur); QGroupBox *groupOptions = new QGroupBox("Options"); groupOptions->setLayout(optionsLayout); // Groupe : Commentaires auteur = new QLineEdit; date = new QDateEdit; date->setDate(QDate::currentDate()); role = new QTextEdit; QFormLayout *commentairesLayout = new QFormLayout; commentairesLayout->addRow("&Auteur :", auteur); commentairesLayout->addRow("Da&te de création :", date); commentairesLayout->addRow("&Rôle de la classe :", role); groupCommentaires = new QGroupBox("Ajouter des commentaires"); groupCommentaires->setCheckable(true); groupCommentaires->setChecked(false); groupCommentaires->setLayout(commentairesLayout); // Layout : boutons du bas (générer, quitter...) generer = new QPushButton("&Générer !"); quitter = new QPushButton("&Quitter"); QHBoxLayout *boutonsLayout = new QHBoxLayout; boutonsLayout->setAlignment(Qt::AlignRight); boutonsLayout->addWidget(generer); boutonsLayout->addWidget(quitter); // Définition du layout principal, du titre de la fenêtre, etc. QVBoxLayout *layoutPrincipal = new QVBoxLayout; layoutPrincipal->addWidget(groupDefinition); layoutPrincipal->addWidget(groupOptions); layoutPrincipal->addWidget(groupCommentaires); layoutPrincipal->addLayout(boutonsLayout); setLayout(layoutPrincipal); setWindowTitle("Zero Class Generator"); setWindowIcon(QIcon("icone.png")); resize(400, 450); // Connexions des signaux et des slots connect(quitter, SIGNAL(clicked()), qApp, SLOT(quit())); connect(generer, SIGNAL(clicked()), this, SLOT(genererCode())); }
DataWidget::DataWidget(DataDescription *dataDescription, WidgetWindowsManager *widgetWindowsManager, MainWindow *mainWindow, bool inside) : AbstractWidgetWindow(widgetWindowsManager, mainWindow, inside) { _dataDescription = dataDescription; _internalWidget = 0; // For the plot widget _curve = 0; _curveData = 0; _dataWidgetNames = _mainWindow->dataWidgetNames(); _dataWidgetPossibilities = _mainWindow->dataWidgetPossibilities() ->value( _dataDescription->type).values(); // Init context menu actions QActionGroup *actionGroup = new QActionGroup(this); for (int i = 0; i < _dataWidgetPossibilities.count(); i++) { QAction *action = new QAction( _dataWidgetNames ->value(_dataWidgetPossibilities.at(i)), actionGroup); action->setCheckable(true); if (_dataWidgetPossibilities.at(i) == _dataDescription->widget) { action->setChecked(true); } QObject::connect(action, SIGNAL(triggered()), this, SLOT(widgetTypeChanged())); actionGroup->addAction(action); } addActions(actionGroup->actions()); // Set attributes setContextMenuPolicy(Qt::ActionsContextMenu); // Init GUI setWindowTitle(_dataDescription->descriptionString); setWindowIcon(QIcon(":/images/widget.png")); // Set layout QVBoxLayout *globalLayout = new QVBoxLayout(); setLayout(globalLayout); QHBoxLayout *topLayout = new QHBoxLayout(); topLayout->addWidget(_inOutButton); QString labelText = _dataDescription->descriptionString; if (_dataDescription->descriptionString.size() > 14) { labelText.truncate(12); labelText.append("..."); } QLabel *dataTitle = new QLabel(labelText); dataTitle->setToolTip(_dataDescription->descriptionString); topLayout->addWidget(dataTitle, 0, Qt::AlignHCenter); dataTitle->setFixedHeight(dataTitle->sizeHint().height()); globalLayout->addLayout(topLayout); // Create internal widget createInternalWidget(); setParent(0); // Needed if it is a flying window // Will be updated anyway if it goes into the MDI area // However the object HAS to be constructed with the main window as parent // so it can connect to its slots. // Setup automatic cleanup QObject::connect(this, SIGNAL(destroyed()), _mainWindow, SLOT(removeDestroyedDataWidgets())); qDebug() << "DataWidget : initializing [desc" << _dataDescription->descriptionString << "; id" << _dataDescription->id << "; type" << _dataDescription->type << "; min" << _dataDescription->valMin << "; max" << _dataDescription->valMax << "; widget" << _dataDescription->widget << "]"; }
/* -------------------------------------------------------------------------- * createColorChooser * * Creates a simple widget for choosing an RGB color value. * -------------------------------------------------------------------------- */ void ObjectPanel::createColorChooser() { QLabel *labelR = new QLabel( tr( "Red" ) ); QLabel *labelG = new QLabel( tr( "Green" ) ); QLabel *labelB = new QLabel( tr( "Blue" ) ); QSpinBox *spinBoxR = new QSpinBox; QSpinBox *spinBoxG = new QSpinBox; QSpinBox *spinBoxB = new QSpinBox; m_pSliderR = new QSlider( Qt::Horizontal ); m_pSliderG = new QSlider( Qt::Horizontal ); m_pSliderB = new QSlider( Qt::Horizontal ); labelR->setFixedWidth( 40 ); labelG->setFixedWidth( 40 ); labelB->setFixedWidth( 40 ); spinBoxR->setRange( 0, 255 ); spinBoxG->setRange( 0, 255 ); spinBoxB->setRange( 0, 255 ); m_pSliderR->setRange( 0, 255 ); m_pSliderG->setRange( 0, 255 ); m_pSliderB->setRange( 0, 255 ); /* Connect status changes of spinboxes to corresponding * sliders and vice versa. */ connect( spinBoxR, SIGNAL( valueChanged( int ) ), m_pSliderR, SLOT( setValue( int ) ) ); connect( m_pSliderR, SIGNAL( valueChanged( int ) ), spinBoxR, SLOT( setValue( int ) ) ); connect( spinBoxG, SIGNAL( valueChanged( int ) ), m_pSliderG, SLOT( setValue( int ) ) ); connect( m_pSliderG, SIGNAL( valueChanged( int ) ), spinBoxG, SLOT( setValue( int ) ) ); connect( spinBoxB, SIGNAL( valueChanged( int ) ), m_pSliderB, SLOT( setValue( int ) ) ); connect( m_pSliderB, SIGNAL( valueChanged( int ) ), spinBoxB, SLOT( setValue( int ) ) ); /* Connect the color change signal sent by Renderer. (to this) */ connect( m_pRenderer, SIGNAL( objectRGB( int, int, int ) ), this, SLOT( setRGBValues( int, int, int ) ) ); /* Connect the color change signal sent by this. (to the renderer) */ connect( this, SIGNAL( colorChanged( int, int, int) ), m_pRenderer, SLOT( changeObjectColor( int, int, int ) ) ); /* Call sendRGBValues() if any of the sliders change state. */ connect( m_pSliderR, SIGNAL( valueChanged( int ) ), this, SLOT( sendRGBValues() ) ); connect( m_pSliderG, SIGNAL( valueChanged( int ) ), this, SLOT( sendRGBValues() ) ); connect( m_pSliderB, SIGNAL( valueChanged( int ) ), this, SLOT( sendRGBValues() ) ); spinBoxR->setValue( 0 ); spinBoxG->setValue( 0 ); spinBoxB->setValue( 0 ); /* Create layout for the widget. */ QHBoxLayout *layoutR = new QHBoxLayout; QHBoxLayout *layoutG = new QHBoxLayout; QHBoxLayout *layoutB = new QHBoxLayout; layoutR->addWidget( labelR ); layoutR->addWidget( m_pSliderR ); layoutR->addWidget( spinBoxR ); layoutG->addWidget( labelG ); layoutG->addWidget( m_pSliderG ); layoutG->addWidget( spinBoxG ); layoutB->addWidget( labelB ); layoutB->addWidget( m_pSliderB ); layoutB->addWidget( spinBoxB ); QVBoxLayout *layout = new QVBoxLayout; layout->addLayout( layoutR ); layout->addLayout( layoutG ); layout->addLayout( layoutB ); setLayout( layout ); }