CompassFrame::CompassFrame(EQPlayer* player, QWidget* parent, const char* name) : SEQWindow("Compass", "ShowEQ - Compass", parent, name) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setAutoAdd(true); m_compass = new Compass (this, "compass"); QHBox* coordsbox = new QHBox(this); m_compass->setFixedWidth(120); m_compass->setFixedHeight(120); for(int a=0;a<2;a++) { if((a+showeq_params->retarded_coords)%2 == 0) { // Create the x: label QLabel *labelx = new QLabel(showeq_params->retarded_coords?"E/W:":"X:", coordsbox); labelx->setFixedHeight(labelx->sizeHint().height()); labelx->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter); // Create the xpos label m_xPos = new QLabel("----",coordsbox); m_xPos->setFixedHeight(m_xPos->sizeHint().height()); m_xPos->setAlignment(QLabel::AlignRight|QLabel::AlignVCenter); } else { // Create the y: label QLabel *labely = new QLabel(showeq_params->retarded_coords?"N/S:":"Y:", coordsbox); labely->setFixedHeight(labely->sizeHint().height()); labely->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter); // Create the ypos label m_yPos = new QLabel("----",coordsbox); m_yPos->setFixedHeight(m_yPos->sizeHint().height()); m_yPos->setAlignment(QLabel::AlignRight|QLabel::AlignVCenter); } } // Create the z: label QLabel *labelz = new QLabel("Z:",coordsbox); labelz->setFixedHeight(labelz->sizeHint().height()); labelz->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter); // Create the zpos label m_zPos = new QLabel("----",coordsbox); m_zPos->setFixedHeight(m_zPos->sizeHint().height()); m_zPos->setAlignment(QLabel::AlignRight|QLabel::AlignVCenter); // connect connect(player, SIGNAL(posChanged(int16_t,int16_t,int16_t, int16_t,int16_t,int16_t,int32_t)), this, SLOT(posChanged(int16_t,int16_t,int16_t, int16_t,int16_t,int16_t,int32_t))); // initialize compass m_compass->setPos(player->getPlayerX(), player->getPlayerY()); m_compass->setHeading(player->getPlayerHeading()); }
SketchMainHelpPrivate::SketchMainHelpPrivate ( const QString &viewString, const QString &htmlText, SketchMainHelp *parent) : QFrame() { setObjectName("sketchMainHelp"+viewString); m_parent = parent; QFrame *main = new QFrame(this); QHBoxLayout *mainLayout = new QHBoxLayout(main); QLabel *imageLabel = new QLabel(this); QLabel *imageLabelAux = new QLabel(imageLabel); imageLabelAux->setObjectName(QString("inviewHelpImage%1").arg(viewString)); QPixmap pixmap(QString(":/resources/images/helpImage%1.png").arg(viewString)); imageLabelAux->setPixmap(pixmap); imageLabel->setFixedWidth(pixmap.width()); imageLabel->setFixedHeight(pixmap.height()); imageLabelAux->setFixedWidth(pixmap.width()); imageLabelAux->setFixedHeight(pixmap.height()); ExpandingLabel *textLabel = new ExpandingLabel(this); textLabel->setLabelText(htmlText); textLabel->setFixedWidth(430 - 41 - pixmap.width()); textLabel->allTextVisible(); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); textLabel->setToolTip(""); textLabel->setAlignment(Qt::AlignLeft); mainLayout->setSpacing(6); mainLayout->setMargin(2); mainLayout->addWidget(imageLabel); mainLayout->addWidget(textLabel); setFixedWidth(430); QVBoxLayout *layout = new QVBoxLayout(this); m_closeButton = new SketchMainHelpCloseButton(viewString,this); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(doClose())); QFrame *bottomMargin = new QFrame(this); bottomMargin->setFixedHeight(m_closeButton->height()); layout->addWidget(m_closeButton); layout->addWidget(main); layout->addWidget(bottomMargin); layout->setSpacing(0); layout->setMargin(2); m_shouldGetTransparent = false; //m_closeButton->doHide(); QFile styleSheet(":/resources/styles/inviewhelp.qss"); if (!styleSheet.open(QIODevice::ReadOnly)) { qWarning("Unable to open :/resources/styles/inviewhelp.qss"); } else { setStyleSheet(styleSheet.readAll()); } }
// // // CButDlg Class // // Provide a dialog to add/edit a filter button to the MsgDialog // CButDlg::CButDlg(QWidget *parent, QString name, MyButton *but) : QDialog(parent, name, TRUE) { QBoxLayout *topLayout = new QVBoxLayout(this); QBoxLayout *row1Layout = new QHBoxLayout(topLayout); QBoxLayout *row2Layout = new QHBoxLayout(topLayout); QFont labelFont(font()); labelFont.setBold(true); QLabel *nameLabel = new QLabel ("Name", this); nameLabel->setFont(labelFont); nameLabel->setFixedHeight(nameLabel->sizeHint().height()); nameLabel->setFixedWidth(80); nameLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter); row1Layout->addWidget(nameLabel); QLineEdit *nameEdit = new QLineEdit (this, "Name"); nameEdit->setText(but->text()); nameEdit->setFont(labelFont); nameEdit->setFixedHeight(nameEdit->sizeHint().height()); nameEdit->setFixedWidth(150); row1Layout->addWidget(nameEdit); QLabel *filterLabel = new QLabel ("Filter", this); filterLabel->setFont(labelFont); filterLabel->setFixedHeight(filterLabel->sizeHint().height()); filterLabel->setFixedWidth(80); filterLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter); row2Layout->addWidget(filterLabel); QLineEdit *filterEdit = new QLineEdit (this, "Filter"); filterEdit->setText(but->filter()); filterEdit->setFont(labelFont); filterEdit->setFixedHeight(filterEdit->sizeHint().height()); filterEdit->setFixedWidth(150); row2Layout->addWidget(filterEdit); QPushButton *ok = new QPushButton("OK", this); ok->setFixedWidth(30); ok->setFixedHeight(30); topLayout->addWidget(ok, 0, AlignCenter); // connect sigs connect(nameEdit, SIGNAL(textChanged(const QString &)), but, SLOT(setText(const QString &))); connect(filterEdit, SIGNAL(textChanged(const QString &)), but, SLOT(setFilter(const QString &))); connect(ok, SIGNAL(clicked()), SLOT(accept())); setMaximumSize(QSize(sizeHint())); }
/** * Constructor */ ClsQPrcMonitor::ClsQPrcMonitor(QWidget *parent, const char * /* name=0 */, WFlags /* f=0 */) : // QWidget ( parent, name, WStyle_Title |WStyle_NoBorder ) { QDialog ( parent) { QPixmap qpixmapPrc_alive = QPixmap (prc_alive); qpixmapPrc_launched = QPixmap (prc_launched); qpixmapPrc_ready = QPixmap (prc_ready); qpixmapPrc_sfp = QPixmap (prc_sfp); qpixmapPrc_mt = QPixmap (prc_mt); this->setBackgroundColor(QColor(0,0,0)); qgltPrcs = new QGridLayout( this, 1, 8, 1 ); QLabel *l; l = new QLabel(" PrcID ", this, "PrcID", 0); l->setFixedHeight(l->sizeHint().height()); qgltPrcs->addWidget(l,0,0); l = new QLabel("port ", this, "port", 0); l->setFixedHeight(l->sizeHint().height()); qgltPrcs->addWidget(l,0,1); l = new QLabel("A", this, "A", 0); l->setAlignment(AlignCenter); QToolTip::add( l, "Prc alive" ); qgltPrcs->addWidget(l,0,2); l = new QLabel("P", this, "P", 0); l->setAlignment(AlignCenter); QToolTip::add( l, "Prc systemfile parsed" ); qgltPrcs->addWidget(l,0,3); l = new QLabel("B", this, "B", 0); l->setAlignment(AlignCenter); QToolTip::add( l, "Prc system buildt" ); qgltPrcs->addWidget(l,0,4); l = new QLabel("C", this, "C", 0); l->setAlignment(AlignCenter); QToolTip::add( l, "Prc connected" ); qgltPrcs->addWidget(l,0,5); l = new QLabel("R", this, "R", 0); l->setAlignment(AlignCenter); QToolTip::add( l, "Prc ready" ); qgltPrcs->addWidget(l,0,6); l = new QLabel(" speed ", this, "speed", 0); l->setFixedHeight(l->sizeHint().height()); qgltPrcs->addWidget(l,0,NR_STATES+2); };
NBCategoryMenu::NBCategoryMenu( QString catName, QPixmap icon, QString wNode, QModelIndexList nodeList, QWidget *parent ) : QMenu( parent ) { mCategory = catName; mWorkNode = wNode; sNodes << nodeList; QWidgetAction *title = new QWidgetAction( this ); QWidget *actBase = new QWidget( this ); QLabel *pix = new QLabel(); pix->setFixedSize( 20, 20 ); pix->setPixmap( icon.scaled( 16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); pix->setAlignment( Qt::AlignCenter ); QLabel *name = new QLabel( "<b>" + catName + "</b>" ); name->setFixedHeight( 20 ); name->setAlignment( Qt::AlignVCenter ); QHBoxLayout *lyt = new QHBoxLayout(); lyt->setContentsMargins( QMargins( 4, 4, 4, 0 ) ); lyt->addWidget( pix ); lyt->addWidget( name ); actBase->setLayout( lyt ); title->setDefaultWidget( actBase ); addAction( title ); addSeparator(); populateMenu(); };
ServerTab::ServerTab() { // QLabel *legendLabel = new QLabel("Liste des clients connectés au serveur."); legendLabel->setFixedHeight(40); // TabWidget QTableWidget *tableWidget = new QTableWidget(); tableWidget->setColumnCount(6); // resize to contents tableWidget->setColumnWidth(0, 300); tableWidget->setColumnWidth(4, 120); QStringList listHeaders; listHeaders << "Nom du client" << "ID de connexion" << "Adresse IP" << "Statut" << "Début de connexion" << "Fin de connexion"; tableWidget->setHorizontalHeaderLabels(listHeaders); tableWidget->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft); // Layering QVBoxLayout *vl = new QVBoxLayout(); setLayout(vl); vl->addWidget(legendLabel); vl->addWidget(tableWidget); }
QLayout* ColorDlg::__initializeLayoutVertical() { QGridLayout* pL = new QGridLayout( this, 8, 2, 5, 2 ); pL->addWidget(new QLabel(tr( "Line"), this), 0, 0); pL->addWidget(pCB_Line, 0, 1); pL->addWidget(new QLabel(tr( "Back"), this), 1, 0); pL->addWidget(pCB_BGColor, 1, 1); pL->addWidget(new QLabel(tr( "BallLine"), this), 2, 0); pL->addWidget(pCB_BallLine, 2, 1); QLabel* pTL; pTL = new QLabel(this); pTL->setFixedHeight(20); pL->addMultiCellWidget(pTL, 3, 3, 0, 1); pL->addMultiCellWidget(pRB_UseColorList, 4, 4, 0, 1); pL->addMultiCellWidget(pRB_UseSameColor, 5, 5, 0, 1); pTL = new QLabel(this); pTL->setFixedWidth(60); pL->addWidget(pTL, 6, 0); pL->addWidget(pCB_BallColor, 6, 1); pL->addMultiCellWidget( pOK, 7, 7, 0, 1 ); return pL; }
AppHistoryTab::AppHistoryTab() { // QLabel *legendLabel = new QLabel("Historique des applications depuis la connexion au serveur."); legendLabel->setFixedHeight(40); // TabWidget QTableWidget *tableWidget = new QTableWidget(); tableWidget->setColumnCount(6); // resize to contents tableWidget->setColumnWidth(0, 300); QStringList listHeaders; listHeaders << "Nom" << "PID" << "Statut" << "UID" << "Date de début" << "Date de fin"; tableWidget->setHorizontalHeaderLabels(listHeaders); tableWidget->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft); // Layering QVBoxLayout *vl = new QVBoxLayout(); setLayout(vl); vl->addWidget(legendLabel); vl->addWidget(tableWidget); }
int main(int argc, char** argv) { QApplication app(argc, argv); QWidget wgt; wgt.setWindowTitle("LineEdit"); QLabel* plblDisplay = new QLabel; plblDisplay->setFrameStyle(QFrame::Box | QFrame::Raised); plblDisplay->setLineWidth(2); plblDisplay->setFixedHeight(50); QLabel* plblText = new QLabel("&Text"); QLineEdit* ptxt = new QLineEdit; plblText->setBuddy(ptxt); QObject::connect(ptxt, SIGNAL(textChanged(const QString&)), plblDisplay, SLOT(setText(const QString&))); QLabel* plblPassword = new QLabel("&Password"); QLineEdit* ptxtPassword = new QLineEdit; plblPassword->setBuddy(ptxtPassword); ptxtPassword->setEchoMode(QLineEdit::Password); QObject::connect(ptxtPassword, SIGNAL(textChanged(const QString&)), plblDisplay, SLOT(setText(const QString&))); QVBoxLayout* pvbxLayout = new QVBoxLayout; pvbxLayout->addWidget(plblDisplay); pvbxLayout->addWidget(plblText); pvbxLayout->addWidget(ptxt); pvbxLayout->addWidget(plblPassword); pvbxLayout->addWidget(ptxtPassword); wgt.setLayout(pvbxLayout); wgt.show(); return app.exec(); }
void ProgressDialog::setupGui(const QString& heading) { QVBox* vbox = makeVBoxMainWidget(); vbox->setSpacing(10); QWidget* headingBox = new QWidget(vbox); QHBoxLayout* hboxLayout = new QHBoxLayout(headingBox); QLabel* textLabel = new QLabel(heading, headingBox); textLabel->setMinimumWidth(textLabel->sizeHint().width()); textLabel->setFixedHeight(textLabel->sizeHint().height()); hboxLayout->addWidget(textLabel); hboxLayout->addStretch(); d->gear = new KAnimWidget(QString("kde"), 32, headingBox); d->gear->setFixedSize(32, 32); hboxLayout->addWidget(d->gear); d->resultbox = new QListBox(vbox); d->resultbox->setSelectionMode(QListBox::NoSelection); QFontMetrics fm(d->resultbox->fontMetrics()); d->resultbox->setMinimumSize(fm.width("0")*70, fm.lineSpacing()*8); resize(sizeHint()); }
HistoryView::HistoryView(QWidget *parent, QWebHistory *webHistory) : QWidget(parent) { history = webHistory; mainLayaut = new QVBoxLayout; historyList = new QListWidget(this); historyList->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); historyList->setAutoScroll(true); historyList->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); historyList->setSpacing(2); QLabel *title = new QLabel(QString("Historia odwiedzanych stron"), this); title->setFocusPolicy(Qt::NoFocus); title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); title->setFixedHeight(20); QFont titleFont; titleFont.setPointSize(8); title->setFont(titleFont); mainLayaut->setSpacing(0); mainLayaut->setMargin(0); mainLayaut->addWidget(title); mainLayaut->addWidget(historyList); this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); this->setLayout(mainLayaut); this->setupActions(); }
QWidget *PartsEditorViewsWidget::addZoomControlsAndBrowseButton(PartsEditorView *view) { QFrame *container1 = new QFrame(this); QVBoxLayout *lo1 = new QVBoxLayout(container1); lo1->setSpacing(1); lo1->setMargin(0); QLabel *button = new QLabel(QString("<a href='#'>%1</a>").arg(tr("Load image..")), this); button->setObjectName("browseButton"); button->setMinimumWidth(85); button->setMaximumWidth(85); button->setFixedHeight(20); button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); connect(button, SIGNAL(linkActivated(const QString&)), view, SLOT(loadFile())); QHBoxLayout *lo2 = new QHBoxLayout(); lo2->setSpacing(1); lo2->setMargin(0); lo2->addWidget(button); lo2->addWidget(new ZoomControls(view,container1)); lo1->addWidget(view); lo1->addLayout(lo2); return container1; }
void ConflictResolutionScreen::problemSolutionWidget( const QString & probDescription, const QStringList & solutions ) { m_solId = -1; if ( m_solutionWidget != NULL && m_questionLabel != NULL ) { m_mainLayout->removeWidget( m_questionLabel ); m_mainLayout->removeWidget( m_solutionWidget ); } QLabel *questionLabel = new QLabel( probDescription ); questionLabel->setStyleSheet( "background-color: rgb(254, 250, 210); border-bottom : 1px solid rgb(252,233,79); border-left : 1px solid rgb(196,181,147); border-top : 1px solid rgb(196,181,147); border-right : 1px solid rgb(196,181,147);" ); questionLabel->setFixedHeight( 50 ); questionLabel->setWordWrap( true ); QWidget *solutionWidget = new QWidget; solutionWidget->setObjectName( "solutionWidget" ); solutionWidget->setStyleSheet( "QWidget#solutionWidget{ background-color : white; border-bottom: 1px solid rgb(196, 181, 147); border-left : 1px solid rgb(196,181,147); border-top : 1px solid rgb(196,181,147); border-right : 1px solid rgb(196,181,147); }" ); QVBoxLayout *solutionLayout = new QVBoxLayout( solutionWidget ); solutionLayout->setSpacing( 0 ); int radioId = 0; for ( QString solution : solutions ) { QRadioButton *sol = new QRadioButton( solution ); m_buttonGroup.addButton( sol, radioId++ ); sol->setStyleSheet( "padding-left: 40px;" ); solutionLayout->addWidget( sol ); solutionLayout->setSpacing( 10 ); } m_questionLabel = questionLabel; m_solutionWidget = solutionWidget; m_mainLayout->addWidget( questionLabel ); m_mainLayout->setSpacing( 0 ); m_mainLayout->addWidget( solutionWidget ); }
void ForgetPwdVerifyPage::initializeWidget() { //提示信息页面操作 hintMsgPage = new HintMsgPage(this); hintMsgPage->hide(); connect(hintMsgPage, SIGNAL(submitClicked(bool)), this, SLOT(on_hintMsgPage(bool))); //导航栏 QString strTitle = tr("验 证"); QString strLeftBtn = tr("取消"); QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS); navigationBar = new NavigationBar(this); navigationBar->setTitleText(strTitle); navigationBar->setLeftText(strLeftBtn); navigationBar->setLeftPixMap(leftArrowsPixmap); connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked())); QHBoxLayout* pHLTop = new QHBoxLayout(); pHLTop->addWidget(navigationBar); pHLTop->setSpacing(0); pHLTop->setMargin(0); this->setTopbarLayout(pHLTop); //验证部分 QLabel* lblMsgHint = new QLabel(this); lblMsgHint->setText(tr("已发送验证码到您的邮箱")); lblMsgHint->setFixedHeight(this->screenHeight()*0.05); lblMsgHint->setAlignment(Qt::AlignLeft); lblMsgHint->setContentsMargins(this->screenWidth()*0.02, 0, this->screenWidth()*0.02, 0); lblMsgHint->setStyleSheet("color:rgb(122,123,128); font:16px;"); editValidate = new QLineEdit(this); editValidate->setFixedHeight(this->screenHeight()*0.08); editValidate->setPlaceholderText(tr("输入6位验证码")); editValidate->setStyleSheet(SheetStyle::FORGETPWD_VALIDATION_LINEEDIT); editValidate->setTextMargins(this->screenWidth()*0.02, 0, this->screenWidth()*0.02, 0); QVBoxLayout* vbInfoLayout = new QVBoxLayout; vbInfoLayout->addWidget(lblMsgHint); vbInfoLayout->addWidget(editValidate); vbInfoLayout->setAlignment(Qt::AlignCenter); vbInfoLayout->setSpacing(0); vbInfoLayout->setMargin(0); btnNextStep = new QPushButton(tr("下一步"), this); btnNextStep->setFixedHeight(this->screenHeight()*0.074); btnNextStep->setStyleSheet(SheetStyle::QPUSHBUTTON); connect(btnNextStep, SIGNAL(clicked()), this, SLOT(on_btnNextStep_clicked())); QVBoxLayout* vbLayout = new QVBoxLayout; vbLayout->addLayout(vbInfoLayout); vbLayout->addSpacing(this->screenHeight()*0.03); vbLayout->addWidget(btnNextStep); vbLayout->setAlignment(Qt::AlignTop); vbLayout->addStretch(0); vbLayout->addSpacing(0); vbLayout->setContentsMargins(this->screenWidth()*0.054,this->screenHeight()*0.026,this->screenWidth()*0.054,0); this->setBodyPartLayout(vbLayout); }
void MorePage::initializeWidget() { //导航栏 QString strTitle = tr("更多..."); navigationBar = new NavigationBar(this); navigationBar->setTitleText(strTitle); QHBoxLayout* pHLTop = new QHBoxLayout(); pHLTop->addWidget(navigationBar); pHLTop->setSpacing(0); pHLTop->setMargin(0); this->setTopbarLayout(pHLTop); //个人信息 QLabel* themeWidget = new QLabel; QPixmap pixmap = QPixmap(ImagePath::MOREPAGE_THEME); pixmap.setDevicePixelRatio(2); themeWidget->setAutoFillBackground(true); themeWidget->setFixedHeight(this->screenHeight()*0.25); themeWidget->setFixedWidth(this->screenWidth()); themeWidget->setPixmap(pixmap); themeWidget->setScaledContents(true); btnPersonalInfo = new QToolButton; btnPersonalInfo->setFixedWidth(this->screenWidth()); btnPersonalInfo->setFixedHeight(this->screenHeight()*0.15); btnPersonalInfo->setIconSize(QSize(btnPersonalInfo->height()*0.7, btnPersonalInfo->height()*0.7)); btnPersonalInfo->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); btnPersonalInfo->setStyleSheet("font:16px; color:white;background-color:rgba(0,0,0,0)"); connect(btnPersonalInfo, SIGNAL(clicked()), SLOT(on_btnPersonal_clicked())); QVBoxLayout* themeLayout = new QVBoxLayout; themeLayout->addWidget(btnPersonalInfo); themeLayout->setMargin(0); themeWidget->setLayout(themeLayout); //设置 btnSetting = new GroupButton; btnSetting->setStyleSheet(SheetStyle::GROUPBUTTON_BOTTOMBORDER); QPixmap settingPixmap(ImagePath::SETTING); this->setGroupButton(btnSetting, settingPixmap, tr("设置")); connect(btnSetting, SIGNAL(clicked()), SLOT(on_btnSetting_clicked())); QVBoxLayout* vblTotalLayout = new QVBoxLayout; vblTotalLayout->addWidget(themeWidget); vblTotalLayout->addSpacing(this->screenHeight()*0.026); vblTotalLayout->addWidget(btnSetting); vblTotalLayout->setAlignment(Qt::AlignTop); vblTotalLayout->setMargin(0); vblTotalLayout->setSpacing(0); this->setBodyPartLayout(vblTotalLayout); //屏幕触摸滚动设置 this->setBodyScreenHeight(this->scrollAreaHasBottomBarHeight()); this->installScrollViewportArea(); this->loadLocalData(curAccountID); }
foreach(const ElementTypes &elementType, getAvailableElementTypes()){ QLabel *element = new QLabel(); element->setPixmap(QPixmap(getElementTypeIconPath(elementType))); element->setFixedHeight(30); element->setFixedWidth(30); element->setScaledContents(true); element->setVisible(false); this->layout_neededElements->addWidget(element); this->neededElements.insert(elementType, element); }
SaveScm::SaveScm( QWidget *parent, const char *name ) : QDialog( parent, name, TRUE ) { setFocusPolicy(QWidget::StrongFocus); setCaption( i18n("Add a color scheme")); QBoxLayout *topLayout = new QVBoxLayout( this, 10 ); QBoxLayout *stackLayout = new QVBoxLayout( 3 ); topLayout->addLayout( stackLayout ); nameLine = new QLineEdit( this ); nameLine->setFocus(); nameLine->setMaxLength(18); nameLine->setFixedHeight( nameLine->sizeHint().height() ); QLabel* tmpQLabel; tmpQLabel = new QLabel( nameLine, i18n( "&Enter a name for the new color scheme\n"\ "to be added to your personal list.\n\n"\ "The colors currently used in the preview will\n"\ "be copied into this scheme to begin with." ), this ); tmpQLabel->setAlignment( AlignLeft | AlignBottom | ShowPrefix ); tmpQLabel->setFixedHeight( tmpQLabel->sizeHint().height() ); tmpQLabel->setMinimumWidth( tmpQLabel->sizeHint().width() ); stackLayout->addStretch( 10 ); stackLayout->addWidget( tmpQLabel ); stackLayout->addWidget( nameLine ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this ); tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken ); tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() ); topLayout->addWidget( tmpQFrame ); KButtonBox *bbox = new KButtonBox( this ); bbox->addStretch( 10 ); QPushButton *ok = bbox->addButton( i18n( "&OK" ) ); connect( ok, SIGNAL( clicked() ), SLOT( accept() ) ); QPushButton *cancel = bbox->addButton( i18n( "&Cancel" ) ); connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); resize( 250, 0 ); }
GcSubSplitter::GcSubSplitter(Qt::Orientation orientation, GcSplitterControl *control, GcSplitter *parent) : QSplitter(orientation, parent), control(control), gcSplitter (parent) { _insertedWidget = NULL; // we add a fake widget to ensure the first real widget // that is added has a handle (even though it cannot be moved) QLabel *fake = new QLabel("fake"); fake->setFixedHeight(0); setHandleWidth(0); QSplitter::addWidget(fake); //setStretchFactor(0,0); }
void BlocksDisplay::addTrack(Track *t) { QLabel *l = new QLabel(this); l->setFixedWidth(32); l->setFixedHeight(16); l->setText(QString::number(nextTrack+1).append(':')); ui->gridLayout->addWidget(l, nextTrack, 0); int numSectors = Track_numSectors(t); for (int i = 0; i < numSectors;) { BlockStatus s = Track_blockStatus(t, i); int status = 0; if (s & BS_ALLOCATED) status = 2; else if (s & BS_RESERVED) status = 1; l = new QLabel(this); l->setFixedWidth(16); l->setFixedHeight(16); l->setPixmap(statusIcons[status]); ui->gridLayout->addWidget(l, nextTrack, ++i); } ++nextTrack; }
void KStatusBar::insertPermanentItem( const QString& text, int id, int stretch) { if (d->items[id]) { kDebug() << "KStatusBar::insertPermanentItem: item id " << id << " already exists."; } QLabel *l = new QLabel( text, this ); l->installEventFilter( this ); l->setFixedHeight( fontMetrics().height() + 2 ); l->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); d->items.insert( id, l ); addPermanentWidget( l, stretch ); l->show(); }
void BitcoinGUI::createToolBars() { if(walletFrame) { toolbar = new QToolBar(tr("Tabs toolbar")); toolbar->setObjectName("toolbar"); addToolBar(Qt::LeftToolBarArea, toolbar); toolbar->setMovable(false); toolbar->setFixedWidth(200); toolbar->setMinimumHeight(500); toolbar->setIconSize(QSize(16, 16)); QLabel *labelLogo = new QLabel(toolbar); labelLogo->setFixedWidth(200); labelLogo->setFixedHeight(110); labelLogo->setPixmap(QPixmap(":css/logo")); labelLogo->setObjectName("labelLogo"); QWidget* spacer1 = new QWidget(); spacer1->setFixedWidth(20); spacer1->setObjectName("spacer1"); spacer1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addWidget(labelLogo); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->setMovable(false); // remove unused icon in upper left corner overviewAction->setChecked(true); /** Create additional container for toolbar and walletFrame and make it the central widget. This is a workaround mostly for toolbar styling on Mac OS but should work fine for every other OSes too. */ QWidget *containerWidget = new QWidget(); QBoxLayout *layout = new QBoxLayout(QBoxLayout::LeftToRight, containerWidget); layout->addWidget(toolbar); layout->addWidget(spacer1); layout->addWidget(walletFrame); layout->setSpacing(0); layout->setContentsMargins(QMargins()); containerWidget->setLayout(layout); setCentralWidget(containerWidget); } }
YGWidget::YGWidget(int timeSecs, UISetting::FontType fontType, quint8 btnsFlag, QWidget *parent /*= 0*/): QWidget(parent), LanguageResAid(true), m_timerLbl(0), m_bgImage(QImage()), m_winPos(QPoint(0,0)), m_mousePos(QPoint(0,0)), m_deltaPos(QPoint(0,0)), m_closable(false), m_movable(false) { setTransparentAndFrameless(); internalInitial(); if(timeSecs != -1) { QString txt = tr("倒计时: "); QLabel *lblTimerTip = new QLabel(txt, this); lblTimerTip->setFixedHeight(QFontMetrics(ygApp->font()).height()+5); // 没有加5,绘制时中文会截断下面一点点,待搞明白为什么; lblTimerTip->setFixedWidth(QFontMetrics(ygApp->font()).width(txt)); lblTimerTip->setStyleSheet(QString("color:#7a828c; font-size:18px;")); lblTimerTip->move(YGW_TIMER_POS - QPoint(90, -15)); lblTimerTip->show(); m_timerLbl = new YGTimerLabel(YGW_TIMER_POS, timeSecs, UISetting::font(fontType), QColor(Qt::red), Qt::AlignHCenter|Qt::AlignVCenter, this); QFont ft = font(); ft.setPixelSize(34); QFontMetrics fontMtr(ft); m_timerLbl->setFixedWidth(fontMtr.width(QString("999"))); m_timerLbl->setFixedHeight(fontMtr.height()); connect(m_timerLbl, SIGNAL(timeout()), this, SLOT(sltShowTimeout())); m_timerLbl->startTimer(true); g_timer = m_timerLbl; } if(btnsFlag != ToolBar::Show_None) { ToolBar *bar = new ToolBar(YGW_BOTTOM_BAR_SIZE, YGW_BOTTOM_BAR_POS, btnsFlag, this); //connect(bar, SIGNAL(sglToolBarCmd(quint8)), this, SLOT(sltToolbarCmd(quint8))); connect(bar, SIGNAL(sglToolBarCmd(/*ToolBar::ToolBarCmd*/quint8)), this, SIGNAL(sglToolBarCmd(/*ToolBar::ToolBarCmd*/quint8))); } connect(this, SIGNAL(sglToolBarCmd(quint8)), this, SLOT(sltToolbarCmd(quint8))); }
void CGraphicMonth::wstawKalendarz() { //mainLayout->removeWidget(kalendarzWidget); QGridLayout* kalendarz = new QGridLayout; kalendarz->setColumnStretch(7,1); for(int i=0;i<7;i++) { QLabel* label = new QLabel(QString("%1").arg(QDate::shortDayName(i+1),1,1)); QFont font; font.setPointSize(mainFontSize); font.setBold(true); label->setAlignment(Qt::AlignCenter); label->setFont(font); label->setFixedHeight(30); if(i==5 || i==6) label->setStyleSheet("*{background-color: rgb(253,95,9,220)}"); kalendarz->addWidget(label,0,i); } int row =1; QDate tempData = miesiac->getWybranaData(); for(int i=0;i<miesiac->getIloscDniMiesiaca();i++) { CGraphicButton* cell = new CGraphicButton; connect(cell,SIGNAL(dzienZmieniony(int,bool)),this,SLOT(dzienZmieniony(int, bool))); cell->setText(QString("%1").arg(i+1,1)); cell->setFixedSize(50,30); QFont font; font.setPointSize(mainFontSize); // font.setBold(true); cell->setFont(font); if((miesiac->getTabliceMiesiaca())[1][i]==1) cell->getSwiateczny()=true; kalendarz->addWidget(cell,row,tempData.dayOfWeek()-1); if(tempData.dayOfWeek()==7) row++; tempData = tempData.addDays(1); } if(kalendarzWidget!=NULL) delete kalendarzWidget; kalendarzWidget = new QWidget; kalendarzWidget->setLayout(kalendarz); QPalette pal(palette()); pal.setColor(QPalette::Background,mainColor); kalendarzWidget->setPalette(pal); kalendarzWidget->setAutoFillBackground(true); mainLayout->addWidget(kalendarzWidget); }
void VirusGenius::changeCaseImage(int x, int y, QString Image) { QImage img; QString pathOfImageToLoad; if (Image == "black") pathOfImageToLoad = imageBlackPath; else if (Image == "white") pathOfImageToLoad = imageWhitePath; else pathOfImageToLoad = imageEmptyPath; img.load(pathOfImageToLoad); QLabel* lab = (QLabel*) ui.gridLayout->itemAtPosition(x, y)->widget(); lab->setPixmap(QPixmap::fromImage(img)); lab->setFixedWidth(img.width()); lab->setFixedHeight(img.height()); }
void CChatWidget::addMsg(const QString& vMsg, const QString& vSenderName, EMsgSendRecv vSendRecv) { QLabel* pMsgItem = new QLabel(m_pRecordWidget); QGridLayout* pMsgLayout = new QGridLayout(pMsgItem); pMsgItem->setLayout(pMsgLayout); QString strTime = QTime::currentTime().toString("HH:mm:ss"); Qt::Alignment align = (vSendRecv == eSend) ? Qt::AlignRight : Qt::AlignLeft; pMsgLayout->addWidget(new QLabel(strTime, pMsgItem), 0, 0, 1, 10, align); pMsgLayout->addWidget(new QLabel(vMsg, pMsgItem), 1, 0, 1, 8, align); pMsgLayout->addWidget(new QLabel(vSenderName, pMsgItem), 1, 9, 1, 1, align); pMsgItem->setFixedHeight(60); m_pRecordWidget->setFixedHeight(m_pRecordWidget->height() + pMsgItem->height()); m_pRecordWidget->layout()->addWidget(pMsgItem); m_psbRecord->setMaximumHeight(this->height()); m_psbRecord->setSliderPosition(m_psbRecord->maximum()); }
QWidget* createDemoWidget( const QString& movieFile ) { QLabel* label = new QLabel; QPushButton* playBtn = new QPushButton("Play"); QPushButton* stopBtn = new QPushButton("Stop"); QWidget* demo = new QWidget; demo->setGeometry( 1, 1, 450, 450 ); demo->setLayout( new QVBoxLayout ); demo->layout()->addWidget( label ); demo->layout()->addWidget( playBtn ); demo->layout()->addWidget( stopBtn ); QMovie* movie = new QMovie(movieFile); label->setMovie( movie ); label->setFixedHeight( 400 ); QObject::connect( playBtn, SIGNAL(clicked()), movie, SLOT(start()) ); QObject::connect( stopBtn, SIGNAL(clicked()), movie, SLOT(stop()) ); return demo; }
RadioButtonDialog::RadioButtonDialog(const QString &labelText, const QList<QString> &radioButtonList, QWidget *parent, Qt::WindowFlags f) : Dialog(parent, true, true), m_result(1) { setWindowTitle(tr("Toonz")); setMinimumSize(20, 20); beginVLayout(); QLabel *label = new QLabel(labelText); label->setAlignment(Qt::AlignLeft); label->setFixedHeight(2 * WidgetHeight); addWidget(label); QButtonGroup *buttonGroup = new QButtonGroup(this); int i; for (i = 0; i < radioButtonList.count(); i++) { QRadioButton *radioButton = new QRadioButton(radioButtonList.at(i)); if (i == m_result - 1) radioButton->setChecked(true); radioButton->setFixedHeight(WidgetHeight); buttonGroup->addButton(radioButton); buttonGroup->setId(radioButton, i); addWidget(radioButton); } bool ret = connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(onButtonClicked(int))); endVLayout(); QPushButton *applyButton = new QPushButton(QObject::tr("Apply")); ret = ret && connect(applyButton, SIGNAL(pressed()), this, SLOT(onApply())); QPushButton *cancelButton = new QPushButton(QObject::tr("Cancel")); ret = ret && connect(cancelButton, SIGNAL(pressed()), this, SLOT(onCancel())); addButtonBarWidget(applyButton, cancelButton); assert(ret); }
/** * @brief Window * @param format */ Window(const QGLFormat &format) { resize(912, 684 + 64); window_gl = new GLWidget(format, this); layout = new QVBoxLayout(); layout->addWidget(window_gl); label = new QLabel( "Pease hit the space bar in order to switch to different tone mapping images.", this); label->setFixedWidth(912); label->setFixedHeight(64); label->setAlignment(Qt::AlignHCenter); layout->addWidget(label); setLayout(layout); setWindowTitle(tr("Tone Mapping Example")); }
/** * Create basic widgets of the Dialog. */ void DialogSelectMaster::createWidgets(Mixer *ptr_mixer) { m_mainFrame = new QWidget( this ); setMainWidget( m_mainFrame ); _layout = new QVBoxLayout(m_mainFrame); _layout->setMargin(0); if ( Mixer::mixers().count() > 1 ) { // More than one Mixer => show Combo-Box to select Mixer // Mixer widget line QHBoxLayout* mixerNameLayout = new QHBoxLayout(); _layout->addItem( mixerNameLayout ); mixerNameLayout->setMargin(0); mixerNameLayout->setSpacing(KDialog::spacingHint()); QLabel *qlbl = new QLabel( i18n("Current mixer:"), m_mainFrame ); mixerNameLayout->addWidget(qlbl); qlbl->setFixedHeight(qlbl->sizeHint().height()); m_cMixer = new KComboBox( false, m_mainFrame); m_cMixer->setObjectName( QLatin1String( "mixerCombo" ) ); m_cMixer->setFixedHeight(m_cMixer->sizeHint().height()); connect( m_cMixer, SIGNAL(activated(int)), this, SLOT(createPageByID(int)) ); for( int i =0; i<Mixer::mixers().count(); i++ ) { Mixer *mixer = (Mixer::mixers())[i]; m_cMixer->addItem( mixer->readableName(), mixer->id() ); } // end for all_Mixers // Make the current Mixer the current item in the ComboBox int findIndex = m_cMixer->findData( ptr_mixer->id() ); if ( findIndex != -1 ) m_cMixer->setCurrentIndex( findIndex ); m_cMixer->setToolTip( i18n("Current mixer" ) ); mixerNameLayout->addWidget(m_cMixer, 1); _layout->addSpacing(KDialog::spacingHint()); } // end if (more_than_1_Mixer)
KeyBinder::KeyBinder(QWidget * parent, const QString & helpText, const QString & defaultText, const QString & resetButtonText) : QWidget(parent) { this->defaultText = defaultText; enableSignal = false; // Two-column tab layout QHBoxLayout * pageKeysLayout = new QHBoxLayout(this); pageKeysLayout->setSpacing(0); pageKeysLayout->setContentsMargins(0, 0, 0, 0); // Table for category list QVBoxLayout * catListContainer = new QVBoxLayout(); catListContainer->setContentsMargins(10, 10, 10, 10); catList = new QListWidget(); catList->setFixedWidth(180); catList->setStyleSheet("QListWidget::item { font-size: 14px; } QListWidget:hover { border-color: #F6CB1C; } QListWidget::item:selected { background: #150A61; color: yellow; }"); catList->setFocusPolicy(Qt::NoFocus); connect(catList, SIGNAL(currentRowChanged(int)), this, SLOT(changeBindingsPage(int))); catListContainer->addWidget(catList); pageKeysLayout->addLayout(catListContainer); // Reset all binds button if (!resetButtonText.isEmpty()) { QPushButton * btnResetAll = new QPushButton(resetButtonText); catListContainer->addWidget(btnResetAll); btnResetAll->setFixedHeight(40); catListContainer->setStretch(1, 0); catListContainer->setSpacing(10); connect(btnResetAll, SIGNAL(clicked()), this, SIGNAL(resetAllBinds())); } // Container for pages of key bindings QWidget * bindingsPagesContainer = new QWidget(); QVBoxLayout * rightLayout = new QVBoxLayout(bindingsPagesContainer); // Scroll area for key bindings QScrollArea * scrollArea = new QScrollArea(); scrollArea->setContentsMargins(0, 0, 0, 0); scrollArea->setWidget(bindingsPagesContainer); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); scrollArea->setWidgetResizable(true); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setStyleSheet("background: #130F2A;"); // Add key binding pages to bindings tab pageKeysLayout->addWidget(scrollArea); pageKeysLayout->setStretch(1, 1); // Custom help text QLabel * helpLabel = new QLabel(); helpLabel->setText(helpText); helpLabel->setStyleSheet("color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-radius: 10px; padding: auto 20px;"); helpLabel->setFixedHeight(24); rightLayout->addWidget(helpLabel, 0, Qt::AlignCenter); // Category list and bind table row heights const int rowHeight = 20; QSize catSize, headerSize; catSize.setHeight(36); headerSize.setHeight(24); // Category list header QListWidgetItem * catListHeader = new QListWidgetItem(tr("Category")); catListHeader->setSizeHint(headerSize); catListHeader->setFlags(Qt::NoItemFlags); catListHeader->setForeground(QBrush(QColor("#130F2A"))); catListHeader->setBackground(QBrush(QColor("#F6CB1C"))); catListHeader->setTextAlignment(Qt::AlignCenter); catList->addItem(catListHeader); // Populate bindingsPages = new QHBoxLayout(); bindingsPages->setContentsMargins(0, 0, 0, 0); rightLayout->addLayout(bindingsPages); QWidget * curPage = NULL; QVBoxLayout * curLayout = NULL; QTableWidget * curTable = NULL; bool bFirstPage = true; selectedBindTable = NULL; bindComboBoxCellMappings = new QHash<QObject *, QTableWidgetItem *>(); bindCellComboBoxMappings = new QHash<QTableWidgetItem *, QComboBox *>(); for (int i = 0; i < BINDS_NUMBER; i++) { if (cbinds[i].category != NULL) { // Add stretch at end of previous layout if (curLayout != NULL) curLayout->insertStretch(-1, 1); // Category list item QListWidgetItem * catItem = new QListWidgetItem(HWApplication::translate("binds (categories)", cbinds[i].category)); catItem->setSizeHint(catSize); catList->addItem(catItem); // Create new page curPage = new QWidget(); curLayout = new QVBoxLayout(curPage); curLayout->setSpacing(2); bindingsPages->addWidget(curPage); if (!bFirstPage) curPage->setVisible(false); } // Description if (cbinds[i].description != NULL) { QLabel * desc = new QLabel(HWApplication::translate("binds (descriptions)", cbinds[i].description)); curLayout->addWidget(desc, 0); QFrame * divider = new QFrame(); divider->setFrameShape(QFrame::HLine); divider->setFrameShadow(QFrame::Plain); curLayout->addWidget(divider, 0); } // New table if (cbinds[i].category != NULL || cbinds[i].description != NULL) { curTable = new QTableWidget(0, 2); curTable->verticalHeader()->setVisible(false); curTable->horizontalHeader()->setVisible(false); curTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch); curTable->verticalHeader()->setDefaultSectionSize(rowHeight); curTable->setShowGrid(false); curTable->setStyleSheet("QTableWidget { border: none; } "); curTable->setSelectionBehavior(QAbstractItemView::SelectRows); curTable->setSelectionMode(QAbstractItemView::SingleSelection); curTable->setFocusPolicy(Qt::NoFocus); connect(curTable, SIGNAL(itemSelectionChanged()), this, SLOT(bindSelectionChanged())); connect(curTable, SIGNAL(itemClicked(QTableWidgetItem *)), this, SLOT(bindCellClicked(QTableWidgetItem *))); curLayout->addWidget(curTable, 0); } // Hidden combo box QComboBox * comboBox = CBBind[i] = new QComboBox(curTable); comboBox->setModel((QAbstractItemModel*)DataManager::instance().bindsModel()); comboBox->setVisible(false); comboBox->setFixedWidth(200); // Table row int row = curTable->rowCount(); QTableWidgetItem * nameCell = new QTableWidgetItem(HWApplication::translate("binds", cbinds[i].name)); nameCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); curTable->insertRow(row); curTable->setItem(row, 0, nameCell); QTableWidgetItem * bindCell = new QTableWidgetItem(comboBox->currentText()); bindCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); curTable->setItem(row, 1, bindCell); curTable->resizeColumnsToContents(); curTable->setFixedHeight(curTable->verticalHeader()->length() + 10); // Updates the text in the table cell connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(bindChanged(const QString &))); // Map combo box and that row's cells to each other bindComboBoxCellMappings->insert(comboBox, bindCell); bindCellComboBoxMappings->insert(nameCell, comboBox); bindCellComboBoxMappings->insert(bindCell, comboBox); }