ForDelete::ForDelete(QString id, QString tabNameAud, QWidget *parent) : QDialog(parent) { tabNameAuditee = tabNameAud; indexTemp = id; QSettings settings("AO_Batrakov_Inc.", "EmployeeClient"); tabNameAuditee = settings.value("Table").toString(); indexTemp = settings.value("Index").toString(); QVBoxLayout *mainLayout = new QVBoxLayout; QSqlQuery query; query.exec("select tbl_name from sqlite_master where type = 'table'");//SQLite QLabel *newLabel = new QLabel; labelLabel = new QLabel; QString toOut; QPushButton *okButton = new QPushButton("Ok"); connect(okButton,SIGNAL(clicked()),this,SLOT(close())); while(query.next()){ if(tabNameAuditee != query.value(0).toString()){//имя таблицы QSqlQuery queryTable; QString table = query.value(0).toString(); QString tableid = table; tableid += "id"; QString tableName = table; tableName += "name"; QString textQuery = "SELECT "; textQuery += tableid; textQuery += ", "; textQuery += tableName; textQuery += " FROM "; textQuery += table; textQuery += " WHERE "; textQuery += tabNameAuditee; textQuery += "id = '"; textQuery += indexTemp; textQuery += "';"; queryTable.exec(textQuery); queryTable.next(); if(queryTable.isActive()){ toOut = tr("Table "); toOut += table; toOut += tr(" contains - "); toOut += QString::number(queryTable.size()); toOut += tr(" records."); newLabel->setStyleSheet("font: bold; color: red;"); }else{ toOut = "No related Tables! Deleting."; newLabel->setStyleSheet("font: bold; color: darkblue;"); } } } newLabel->setText(toOut); mainLayout->addWidget(newLabel); mainLayout->addWidget(okButton); setLayout(mainLayout); setWindowTitle(tr("Conditions for removal...")); }
void MainWindow::UpdateDps(int dps) { QLabel* Label1; QProgressBar* Bar1; int i,j,k; QLabel* dpsLabel = ui->labelDpsValue; dpsLabel->setText(QString::number(dps)); if (dps > DMGMETER_HIGH_DPS_LIMIT) { dpsLabel->setStyleSheet(DmgMeter::s_UltraStyle); } else if (dps > DMGMETER_NORMAL_DPS_LIMIT) { dpsLabel->setStyleSheet(DmgMeter::s_HighStyle); } else if (dps > DMGMETER_LOW_DPS_LIMIT) { dpsLabel->setStyleSheet(DmgMeter::s_NormalStyle); } else { dpsLabel->setStyleSheet(DmgMeter::s_LowStyle); } }
YGButton* Utility::button_ImageNText(const QSize &size, const QPoint &pos, const QString &bgImagePath, const QString &text, const QString &textColor, int fontPixelSize, bool fontBold, const QString &objName, QWidget *parent) { YGButton *btn= new YGButton(YGButton::ButtonType_ImageBtn, parent); btn->addLanguageRes(QLocale::Chinese, bgImagePath); btn->addLanguageRes(QLocale::English, bgImagePath); if(!objName.isEmpty()) { btn->setObjectName(objName); } btn->resize(size); btn->move(pos); QLabel *lbl = new QLabel(btn); lbl->resize(btn->size()); if(fontBold) { lbl->setStyleSheet(QString("QLabel{background:transparent; color:%1; font-size: %2px; font-weight:bold;}").arg(textColor).arg(fontPixelSize)); } else { lbl->setStyleSheet(QString("QLabel{background:transparent; color:%1; font-size: %2px;}").arg(textColor).arg(fontPixelSize)); } lbl->setText(text); lbl->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); return btn; }
LogViewer::LogViewer(QWidget* parent) : QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout; QLabel* outputLabel = new QLabel; outputLabel->setText("Standard Output:"); outputLabel->setStyleSheet("font-size: 13pt;"); layout->addWidget(outputLabel); _outputView = new QTextEdit; _outputView->setUndoRedoEnabled(false); _outputView->setReadOnly(true); layout->addWidget(_outputView); QLabel* errorLabel = new QLabel; errorLabel->setText("Standard Error:"); errorLabel->setStyleSheet("font-size: 13pt;"); layout->addWidget(errorLabel); _errorView = new QTextEdit; _errorView->setUndoRedoEnabled(false); _errorView->setReadOnly(true); layout->addWidget(_errorView); setLayout(layout); }
SubSection(const QString & title, const QString & description, QLabel * imageLabel) : QWidget() { QHBoxLayout * mainHLayout = new QHBoxLayout(); setLayout(mainHLayout); mainHLayout->addWidget(imageLabel); QVBoxLayout * mainVLayout = new QVBoxLayout(); mainHLayout->addLayout(mainVLayout); QLabel * titleLabel = new QLabel(title); titleLabel->setStyleSheet("QLabel { font-size: 14px; font: bold; color: #242D31; }"); titleLabel->setWordWrap(true); mainVLayout->addWidget(titleLabel); QHBoxLayout * descriptionHLayout = new QHBoxLayout(); mainVLayout->addLayout(descriptionHLayout); descriptionHLayout->addSpacing(35); QLabel * descriptionLabel = new QLabel(description); descriptionLabel->setFixedWidth(700); descriptionLabel->setStyleSheet("QLabel { font-size: 14px; color: black; }"); descriptionLabel->setWordWrap(true); descriptionHLayout->addWidget(descriptionLabel); mainHLayout->setAlignment(Qt::AlignLeft); }
void Widget::cleanHighlights() { for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { QLabel* cellOrigin = getOriginPointToCellMap()[QPair<int,int>(i,j)]; QLabel* cellResult = getResultPointToCellMap()[QPair<int,int>(i,j)];; cellResult->setText(" "); cellResult->setStyleSheet(" "); cellOrigin->setStyleSheet(" "); } } }
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); setGeometry(0, 0, SC_ABOUT_WIDTH, SC_ABOUT_HEIGHT); QPixmap pixmap(SC_ABOUT_IMAGE); setMask(pixmap.mask()); QPalette palette; palette.setBrush(QPalette::Background, pixmap); setPalette(palette); QString qstrVersion = "<span style=\"font-family:" + QString(SC_BOLD_FONT_NAME) + "\">" + tr("stealth") + "<span style=\"color:" + QString(SC_MAIN_COLOR_BLUE) + ";\">" + tr("client") + "</span> " + "<span style=\"color:" + QString(SC_MAIN_COLOR_GREY) + ";\"> V " + QString::fromStdString(FormatVersionNumbers()) + "</span></span>"; QLabel* lblVersion = new QLabel(this); QFont fntVersion = lblVersion->font(); fntVersion.setPixelSize(14); lblVersion->setFont(fntVersion); lblVersion->setAlignment(Qt::AlignCenter); lblVersion->setGeometry(0, 0, 200, 30); lblVersion->move(this->rect().center() - lblVersion->rect().center()); lblVersion->setText(qstrVersion); lblVersion->setStyleSheet("QLabel {color: white;}"); QString qstrCopy = QString::fromUtf8( "\u00A9 2014 AlphabetCoinFund Developers\n" "This is experimental software.\n" "If you don't treat it as such,\n" "you're likely to put an eye out."); QLabel* lblCopy = new QLabel(this); QFont fntCopy = lblCopy->font(); fntCopy.setPixelSize(12); lblCopy->setFont(fntCopy); lblCopy->setAlignment(Qt::AlignCenter); lblCopy->setGeometry(0, 0, 220, 70); QPoint pt = this->rect().center() - lblCopy->rect().center(); lblCopy->move(pt.x(), pt.y() + 60); lblCopy->setText(qstrCopy); // lblCopy->setStyleSheet("QLabel {color: white; background-color: blue;}"); lblCopy->setStyleSheet("QLabel {color: white;}"); move(QApplication::desktop()->screen()->rect().center() - this->rect().center()); }
PatientItemWidget::PatientItemWidget(QString patientId, QString patientName, QString patientCity, QString patientCode, QWidget *parent) : QFrame(parent) { this->parent = dynamic_cast<PatientSearchResultForm*>(parent); this->setStyleSheet("border-top: 2px dashed gray;"); //this->setStyleSheet(" QLabel{ font-size : 18px; font-family : helvetica; color: #BE0A26; }"); this->setContentsMargins(0, 0, 0, 0); id = patientId; hLayout = new QHBoxLayout(); hLayout->setContentsMargins(0, 0, 0, 0); labelLayout = new QVBoxLayout(); labelLayout->setContentsMargins(0, 0, 0, 0); buttonVLabel = new QVBoxLayout(); buttonVLabel->setContentsMargins(0, 0, 0, 0); QLabel *border = new QLabel(this); border->setStyleSheet("border-style: hidden;"); border->setPixmap(QPixmap(":/icons/patientItemLeftBorder.png")); QLabel *nameLabel = new QLabel("NOME <font color=\"black\">" + patientName + "</font>", this); nameLabel->setStyleSheet("border-style: hidden; font-family : helvetica; color: #BE0A26;"); QLabel *cityLabel = new QLabel("COMUNE DI RESIDENZA <font color=\"black\">" + patientCity + "</font>", this); cityLabel->setStyleSheet("border-style: hidden; font-family : helvetica; color: #BE0A26;"); QLabel *codeLabel = new QLabel("ID PAZIENTE <font color=\"black\">" + patientCode+ "</font>", this); codeLabel->setStyleSheet("border-style: hidden; font-family : helvetica; color: #BE0A26;"); ButtonLabel *selectPatientButton = new ButtonLabel(QPixmap(":/icons/patientSelectButton.png"), QPixmap(":/icons/patientSelectButtonPushed.png"), this); selectPatientButton->setStyleSheet("border-style: hidden;"); connect(selectPatientButton, SIGNAL(released()), this, SLOT(selectPatientButtonSlot())); labelLayout->setSpacing(1); //labelLayout->addSpacing(13); labelLayout->addStretch(); labelLayout->addWidget(nameLabel); labelLayout->addWidget(cityLabel); labelLayout->addWidget(codeLabel); labelLayout->addStretch(); buttonVLabel->addSpacing(25); buttonVLabel->addWidget(selectPatientButton); buttonVLabel->addStretch(); hLayout->addWidget(border); hLayout->addSpacing(5); hLayout->addLayout(labelLayout); hLayout->addStretch(); hLayout->addLayout(buttonVLabel); hLayout->addSpacing(20); setLayout(hLayout); }
//Adds a score to interface void ScoreWindow::addScore(ScoreObject *s){ if(!isEndgame) { makeEndGame(); } QLabel *label = new QLabel(ui->frScore); label->setGeometry(4, nextY, 20, 20); if(s->team() == 2) { label->setStyleSheet("background:#44707b"); } else if (s->team() == 1) { label->setStyleSheet("background:#a23a1d"); } label->show(); label = new QLabel(ui->frScore); label->setGeometry(32, nextY, 122, 20); label->setText(s->username()); label->setStyleSheet("color:#333333"); label->show(); label = new QLabel(ui->frScore); label->setGeometry(162, nextY, 66, 20); label->setAlignment(Qt::AlignRight); label->setText(QString::number(s->deaths())); label->setStyleSheet("color:#333333"); label->show(); label = new QLabel(ui->frScore); label->setGeometry(236, nextY, 66, 20); label->setAlignment(Qt::AlignRight); label->setText(QString::number(s->tKills())); label->setStyleSheet("color:#333333"); label->show(); label = new QLabel(ui->frScore); label->setGeometry(310, nextY, 66, 20); label->setAlignment(Qt::AlignRight); label->setText(QString::number(s->mKills())); label->setStyleSheet("color:#333333"); label->show(); label = new QLabel(ui->frScore); label->setGeometry(384, nextY, 66, 20); label->setAlignment(Qt::AlignRight); label->setText(QString::number(s->pKills())); label->setStyleSheet("color:#333333"); label->show(); label = new QLabel(ui->frScore); label->setGeometry(458, nextY, 66, 20); label->setAlignment(Qt::AlignRight); label->setText(QString::number(s->score())); label->setStyleSheet("color:#333333"); label->show(); nextY += 26; }
void StartupView::showDetailsForItem( const QModelIndex & index ) { QLayout * layout = m_projectDetailView->layout(); for( int i = 0; i < layout->count(); i++ ) { delete layout->itemAt(i)->widget(); layout->removeItem(layout->itemAt(i)); } QString name = m_templateListModel->data(index,Qt::ToolTipRole).toString(); QString description = m_templateListModel->data(index,Qt::WhatsThisRole).toString(); if( ! name.isEmpty() ) { QLabel * nameLabel = new QLabel(name); nameLabel->setStyleSheet("QLabel { font: bold }"); layout->addWidget(nameLabel); } if( ! description.isEmpty() ) { QTextEdit * descriptionLabel = new QTextEdit(description); descriptionLabel->setStyleSheet("QTextEdit { border: none; }"); descriptionLabel->setReadOnly(true); layout->addWidget(descriptionLabel); } }
QuickHelp::QuickHelp(QWidget* widget, QPoint pos, QString text) : QFrame(0, Qt::ToolTip), widget_(widget), window_(widget->window()) { setAttribute(Qt::WA_DeleteOnClose); widget_->installEventFilter(this); window_->installEventFilter(this); QLabel* label = new QLabel; label->setStyleSheet( QString("QLabel { background-color: %1; }").arg(label->palette().toolTipBase().color().name()) ); label->setTextFormat(Qt::RichText); // label->setOpenExternalLinks(true); label->setText(text); connect(label, SIGNAL(linkActivated(const QString&)), this, SLOT(openLink(const QString&))); #ifdef QT_MAC_USE_COCOA setFrameStyle(QFrame::NoFrame); #else setFrameStyle(QFrame::Plain|QFrame::StyledPanel); #endif QVBoxLayout* col = new QVBoxLayout; col->setSpacing(0); col->setMargin(0); col->addWidget(label); setLayout(col); move(widget->mapToGlobal(pos)); show(); }
void CGraphicBuildingTile::display(QList<QString> _toDisplay) { QDialog* infoDialog = new QDialog;//(dynamic_cast<QWidget*>(this->parent())); QVBoxLayout* newLayout = new QVBoxLayout(); int q=0; QScrollArea* scrolArea = new QScrollArea(dynamic_cast<QWidget*>(this->parent())); for(int i=0;i<_toDisplay.count();i++) { QLabel* newLabel = new QLabel(_toDisplay.at(i)); newLabel->setFixedWidth(280); newLabel->setMinimumHeight(22); newLabel->setStyleSheet("border: 1px solid black"); newLayout->addWidget(newLabel); q++; } QPalette pal; pal.setColor(QPalette::Background,QColor(230,200,167)); infoDialog->setFixedWidth(330); infoDialog->setMinimumHeight(30+22*q); infoDialog->setLayout(newLayout); infoDialog->setAutoFillBackground(true); infoDialog->setPalette(pal); infoDialog->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog); scrolArea->setWidget(infoDialog); scrolArea->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog); scrolArea->setMaximumHeight(infoDialog->size().height()+2); scrolArea->setWindowTitle(QString("Info about")); scrolArea->show(); }
void accessories(QWidget *baseWidget) { QLabel *player2 = new QLabel(baseWidget); QLabel *name2 = new QLabel("Player 2", baseWidget); QLabel *time2 = new QLabel("00:00:00", baseWidget); QLabel *player1 = new QLabel(baseWidget); QLabel *name1 = new QLabel("Player 1", baseWidget); QLabel *time1 = new QLabel("00:00:00", baseWidget); QLabel *moves = new QLabel(baseWidget); name1->setGeometry(125,610,80,20); time1->setGeometry(120,635,80,20); player1->setGeometry(100,500,100,100); player1->setPixmap(QPixmap(":/Images/profile.png")); name2->setGeometry(125,210,80,20); time2->setGeometry(120,235,80,20); player2->setGeometry(100,100,100,100); player2->setPixmap(QPixmap(":/Images/profile.png")); moves->setGeometry(1000,105,250,550); moves->setStyleSheet("QLabel {background-color: white;}"); }
/*! Create a signal box widget for the \a list of analog signals. */ QWidget* UiSelectSignalDialog::createAnalogSignalBox(QList<int> &list) { // Deallocation: // Ownership is taken over by call to w->setlayout QGridLayout* l = new QGridLayout(); l->setSizeConstraint(QLayout::SetFixedSize); for (int i = 0; i < list.size(); i++) { int id = list.at(i); // Deallocation: "Qt Object trees" (See UiMainWindow) QLabel* cl = new QLabel(" "); QString color = Configuration::instance().analogInCableColor(id).name(); cl->setStyleSheet(QString("QLabel { background-color : %1; }").arg(color)); l->addWidget(cl, 0, i); // Deallocation: "Qt Object trees" (See UiMainWindow) l->addWidget(new QLabel(QString("A%1").arg(id), this), 1, i); // Deallocation: "Qt Object trees" (See UiMainWindow) QCheckBox* cb = new QCheckBox(this); l->addWidget(cb, 2, i); mAnalogSignalsMap.insert(id, cb); } // Deallocation: "Qt Object trees" (See UiMainWindow) QWidget* w = new QWidget(this); w->setLayout(l); return w; }
RenderingColorWidget::RenderingColorWidget(QWidget * parent ) : QWidget(parent) { this->setObjectName("GrayWidget"); QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->setContentsMargins(0,0,0,0); hLayout->setSpacing(10); this->setLayout(hLayout); QLabel* renderingColorLabel = new QLabel(); renderingColorLabel->setText("Rendering Color: "); renderingColorLabel->setStyleSheet("QLabel { font: bold; }"); hLayout->addWidget(renderingColorLabel); m_renderColorWidget = new QWidget(); m_renderColorWidget->setFixedHeight(30); m_renderColorWidget->setFixedWidth(30); hLayout->addWidget(m_renderColorWidget); m_renderColorButton = new QPushButton(); m_renderColorButton->setFlat(true); m_renderColorButton->setText("Select Color"); m_renderColorButton->setObjectName("StandardGrayButton"); hLayout->addWidget(m_renderColorButton); hLayout->addStretch(); bool isConnected = connect(m_renderColorButton, SIGNAL(clicked()), this, SLOT(renderColorButtonClicked())); OS_ASSERT(isConnected); }
LivePanel::LivePanel(QWidget *parent) : QWidget(parent) { QVBoxLayout *vboxLayout = new QVBoxLayout(this); vboxLayout->setSpacing(0); vboxLayout->setMargin(0); splitter = new QSplitter(this); splitter->setOrientation(Qt::Vertical); splitter->setOpaqueResize(false); vboxLayout->addWidget(splitter); QListView *listView = new QListView(splitter); //listView1->setSizePolicy(* new QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum)); //listView1->setGeometry(0,0,400,300); QFrame *frame = new QFrame(splitter); frame->setStyleSheet("background-color:white"); //QMessageBox::about(this,QString::number(frame1->width()),""); //frame1->resize(frame1->width(),frame1->width()*3/4); frame->resize(256,192); //frame1->setFrameStyle(QFrame::Raised); QLabel *label = new QLabel(frame); label->setGeometry(10,10,400,300); label->setFrameStyle(QFrame::Box); label->setStyleSheet("background-color:green"); label->setText("<html><head><body><center><h1>上山打老虎 1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br><h1></center></body></html>"); }
LabelWidget::LabelWidget(QString inputLabel, QWidget *parent) :QWidget(parent) { setAutoFillBackground(true); setMinimumHeight(36); setMaximumHeight(36); setContentsMargins(0,0,0,0); QLabel *label = new QLabel(inputLabel, this); label->setContentsMargins(0,0,0,0); label->setStyleSheet("font-family : helvetica; color: black;"); QLabel *plusIcon = new QLabel(this); plusIcon->setPixmap(QPixmap(":/icons/plusIcon.png")); //QVBoxLayout *vLabelLayout = new QVBoxLayout(); //vLabelLayout->setContentsMargins(0,0,0,0); //vLabelLayout->setSpacing(0); //vLabelLayout->addWidget(label); //QVBoxLayout *vIconLayout = new QVBoxLayout(); //vIconLayout->addWidget(plusIcon); QHBoxLayout *hLayout = new QHBoxLayout(); hLayout->setContentsMargins(27,0,13,0); //hLayout->addSpacing(25); hLayout->addWidget(label); //hLayout->addLayout(vLabelLayout); hLayout->addStretch(); hLayout->addWidget(plusIcon); //hLayout->addLayout(vIconLayout); setLayout(hLayout); }
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 ChatWindow::participantsChanged() { bool atBottom = isNearBottom(); QStringList participants = XmppClient::getInstance().getPublicChatRoom()->participants(); ui->numOnlineLabel->setText(tr("%1 online now:").arg(participants.count())); while (QLayoutItem* item = ui->usersWidget->layout()->takeAt(0)) { delete item->widget(); delete item; } foreach (const QString& participant, participants) { QString participantName = getParticipantName(participant); QLabel* userLabel = new QLabel(); userLabel->setText(participantName); userLabel->setStyleSheet("background-color: palette(light);" "border-radius: 5px;" "color: #267077;" "padding-top: 3px;" "padding-right: 2px;" "padding-bottom: 2px;" "padding-left: 2px;" "border: 1px solid palette(shadow);" "font-size: 14px;" "font-weight: bold"); userLabel->setProperty("user", participantName); userLabel->setCursor(Qt::PointingHandCursor); userLabel->installEventFilter(this); ui->usersWidget->layout()->addWidget(userLabel); }
void ChatWindow::addTimeStamp() { QTimeSpan timePassed = QDateTime::currentDateTime() - lastMessageStamp; int times[] = { timePassed.daysPart(), timePassed.hoursPart(), timePassed.minutesPart() }; QString strings[] = { tr("%n day(s)", 0, times[0]), tr("%n hour(s)", 0, times[1]), tr("%n minute(s)", 0, times[2]) }; QString timeString = ""; for (int i = 0; i < 3; i++) { if (times[i] > 0) { timeString += strings[i] + " "; } } timeString.chop(1); if (!timeString.isEmpty()) { QLabel* timeLabel = new QLabel(timeString); timeLabel->setStyleSheet("color: #333333;" "background-color: white;" "font-size: 14px;" "padding: 4px;"); timeLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); timeLabel->setAlignment(Qt::AlignLeft); bool atBottom = isNearBottom(); ui->messagesVBoxLayout->addWidget(timeLabel); ui->messagesVBoxLayout->parentWidget()->updateGeometry(); Application::processEvents(); numMessagesAfterLastTimeStamp = 0; if (atBottom) { scrollToBottom(); } } }
void PropertyToolBox::addPage( QWidget* page ) { QBoxLayout* pageLayout = qobject_cast<QBoxLayout*>( page->layout() ); if ( pageLayout && pageLayout->direction() == QBoxLayout::TopToBottom ) { pageLayout->setContentsMargins( 5, 5, 5, 5 ); pageLayout->setSpacing( 3 ); for ( int i = 0; i < pageLayout->count(); i++ ) { QLayoutItem* item = pageLayout->itemAt( i ); if ( item->spacerItem() ) continue; QLabel* label = qobject_cast<QLabel*>( item->widget() ); if ( label ) { QString style = "border: none; border-bottom: 1px solid palette(dark);"; if ( i > 0 ) style += "margin-top: 2px;"; label->setStyleSheet( style ); continue; } QBoxLayout* itemLayout = qobject_cast<QBoxLayout*>( item->layout() ); if ( itemLayout && itemLayout->direction() == QBoxLayout::LeftToRight ) { itemLayout->insertSpacing( 0, 10 ); } else { pageLayout->removeItem( item ); QHBoxLayout* wrapperLayout = new QHBoxLayout(); wrapperLayout->addSpacing( 10 ); wrapperLayout->addItem( item ); pageLayout->insertLayout( i, wrapperLayout ); } } } page->setBackgroundRole( QPalette::Base ); addItem( page, page->windowTitle() ); }
DesignAltHeaderView::DesignAltHeaderView(bool t_isBaseline) : OSHeader(new HeaderToggleButton()) { setFixedHeight(40); QHBoxLayout * mainHLayout = new QHBoxLayout(); mainHLayout->setContentsMargins(5,0,5,0); mainHLayout->setSpacing(5); mainHLayout->setAlignment(Qt::AlignLeft); setLayout(mainHLayout); mainHLayout->addWidget(toggleButton); QRegExp nameRegex("^\\S.*"); QRegExpValidator* validator = new QRegExpValidator(nameRegex, this); designAltNameEdit = new QLineEdit(); designAltNameEdit->setAcceptDrops(false); designAltNameEdit->setValidator(validator); mainHLayout->addWidget(designAltNameEdit); removeButton = new SofterRemoveButton(); mainHLayout->addWidget(removeButton); if (t_isBaseline) { designAltNameEdit->setVisible(false); removeButton->setVisible(false); QLabel *lbl = new QLabel("Baseline and Measures Applied to All"); lbl->setStyleSheet("color:#FFFFFF; font:italic bold"); mainHLayout->addWidget(lbl); } }
void SwitchMonitor::initOneScreenMode(){ // for one-screen mode for (int i = 0, length = m_ScreenList.length(); i < length; i++) { // one-screen mode item QWidget *item = new QWidget(m_MonitersWrapper); QVBoxLayout *vLayout = new QVBoxLayout(item); // image label for one-screen mode QSvgWidget *imageSvg = new QSvgWidget(item); imageSvg->setFixedSize(IMAGE_SIZE, IMAGE_SIZE); QLabel* imageLabel = new QLabel(item); imageLabel->setFixedSize(IMAGE_SIZE, IMAGE_SIZE); showThemeImage(getThemeIconPath("project_screen-onlyone-symbolic"), imageSvg, imageLabel); // text label for one-screen mode QLabel *textLabel = new QLabel(item); textLabel->setText(m_ScreenList[i]); textLabel->setAlignment(Qt::AlignCenter); textLabel->setStyleSheet(MONITOR_TEXT_NORMAL_STYLE); // store imagelabel and textlabel into lists, so that we can change their style later m_ImageSvgList << imageSvg; m_ImageLabelList << imageLabel; m_TextLabelList << textLabel; // add above 2 widgets if(getThemeIconPath("project_screen-onlyone-symbolic").endsWith(".svg")){ vLayout->addWidget(imageSvg, 0, Qt::AlignHCenter); }else{ vLayout->addWidget(imageLabel, 0, Qt::AlignHCenter); } vLayout->addWidget(textLabel, 0, Qt::AlignHCenter); m_HBoxLayout->addWidget(item); } }
void KviStatusBar::contextPopupAboutToShow() { if(!m_pContextPopup) return; m_pContextPopup->clear(); if(appletExists(m_pClickedApplet)) { QString szApp = m_pClickedApplet->descriptor()->visibleName(); QString szTmp = QString("<center><b>%1</b></center>").arg(szApp); QLabel * pLabel = new QLabel(szTmp,m_pContextPopup); QPalette p; pLabel->setStyleSheet("background-color: " + p.color(QPalette::Normal, QPalette::Mid).name()); QWidgetAction * pWaction = new QWidgetAction(m_pContextPopup); pWaction->setDefaultWidget(pLabel); m_pContextPopup->addAction(pWaction); m_pClickedApplet->fillContextPopup(m_pContextPopup); szTmp = QString(__tr2qs("Remove %1")).arg(szApp); m_pContextPopup->addSeparator(); m_pContextPopup->addAction(szTmp,this,SLOT(removeClickedApplet())); } if(!m_pAppletsPopup) { m_pAppletsPopup = new QMenu(this); connect(m_pAppletsPopup,SIGNAL(aboutToShow()),this,SLOT(appletsPopupAboutToShow())); connect(m_pAppletsPopup,SIGNAL(triggered(QAction *)),this,SLOT(appletsPopupActivated(QAction *))); }
//! //! Fills the given tool bars in a panel frame with actions for the panel. //! //! \param mainToolBar The main tool bar to fill with actions. //! \param panelToolBar The panel tool bar to fill with actions. //! void TimelinePanel::fillToolBars ( QToolBar *mainToolBar, QToolBar *panelToolBar ) { #ifdef _DEBUG if (!mainToolBar) { Log::debug("The given main tool bar is invalid.", "TimelinePanel::fillToolBars"); return; } #endif // create a label for the frame rectangle scale QLabel *scaleLabel = new QLabel(tr("Scale:"), mainToolBar); scaleLabel->setStyleSheet("margin-right: 2px;"); // create a scroll bar for the frame rectangle scale m_scaleScrollBar = new QScrollBar(mainToolBar); m_scaleScrollBar->setOrientation(Qt::Horizontal); m_scaleScrollBar->setMinimum(3); m_scaleScrollBar->setMaximum(47); m_scaleScrollBar->setSingleStep(2); m_scaleScrollBar->setValue(TimelineWidget::DefaultFrameSize.width()); m_scaleScrollBar->setMinimumWidth(200); connect(m_scaleScrollBar, SIGNAL(valueChanged(int)), m_timelineWidget, SLOT(setFrameWidth(int))); // create a label for separating the scroll bar and the following actions QLabel *separatorLabel = new QLabel(mainToolBar); // fill the main tool bar mainToolBar->addActions(QList<QAction *>() << ui_autoScrollAction); mainToolBar->addSeparator(); mainToolBar->addWidget(scaleLabel); mainToolBar->addWidget(m_scaleScrollBar); mainToolBar->addWidget(separatorLabel); mainToolBar->addActions(QList<QAction *>() << ui_scaleToFitAction); }
QtChatWindow::AlertID QtChatWindow::addAlert(const std::string& alertText) { QWidget* alertWidget = new QWidget(this); QHBoxLayout* alertLayout = new QHBoxLayout(alertWidget); alertLayout_->addWidget(alertWidget); QLabel* alertLabel = new QLabel(this); alertLabel->setText(alertText.c_str()); alertLayout->addWidget(alertLabel); QToolButton* closeButton = new QToolButton(alertWidget); closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); closeButton->setIconSize(QSize(16,16)); closeButton->setCursor(Qt::ArrowCursor); closeButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); connect (closeButton, SIGNAL(clicked()), this, SLOT(handleAlertButtonClicked())); alertLayout->addWidget(closeButton); QPalette palette = alertWidget->palette(); palette.setColor(QPalette::Window, QColor(Qt::yellow)); palette.setColor(QPalette::WindowText, QColor(Qt::black)); alertWidget->setStyleSheet(alertStyleSheet_); alertLabel->setStyleSheet(alertStyleSheet_); AlertID id = nextAlertId_++; alertWidgets_[id] = alertWidget; return id; }
void MessageWidget::showTagLabels() { clearTagLabels(); if (currMsgId.empty()) { return; } MsgTagInfo tagInfo; rsMail->getMessageTag(currMsgId, tagInfo); if (tagInfo.tagIds.empty() == false) { ui.tagsLabel->setVisible(true); MsgTagType Tags; rsMail->getMessageTagTypes(Tags); std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag; for (std::list<uint32_t>::iterator tagId = tagInfo.tagIds.begin(); tagId != tagInfo.tagIds.end(); ++tagId) { Tag = Tags.types.find(*tagId); if (Tag != Tags.types.end()) { QLabel *tagLabel = new QLabel(TagDefs::name(Tag->first, Tag->second.first), this); tagLabel->setMaximumHeight(16); tagLabel->setStyleSheet(TagDefs::labelStyleSheet(Tag->second.second)); tagLabels.push_back(tagLabel); ui.tagLayout->addWidget(tagLabel); ui.tagLayout->addSpacing(3); } } ui.tagLayout->addStretch(); } else { ui.tagsLabel->setVisible(false); } }
void MainWindow::createWidgets() { QFrame* frame = new QFrame(); frame->setStyleSheet(PSS("QWidget { background: kColour1; border-color: kColour2; }")); frame->setFrameStyle(QFrame::Box); QVBoxLayout *layout = new TightVBoxLayout; frame->setLayout(layout); layout->addWidget(new WindowHeader); QWidget* blackSep = new QWidget(); blackSep->setFixedHeight(1); blackSep->setStyleSheet(PSS("QWidget { background: kColour2; }")); layout->addWidget(blackSep); layout->addSpacing(50); { QLabel* deviceImage = new QLabel(); deviceImage->setFixedSize(600, 136); deviceImage->setStyleSheet(QString("QWidget { background-image: url(:/Device); }")); layout->addWidget(deviceImage, 0, Qt::AlignHCenter); } layout->addSpacing(50); m_controlsWidget = new ControlsWidget(); layout->addWidget(m_controlsWidget, 0, Qt::AlignHCenter); layout->addStretch(); setCentralWidget(frame); }
SearchEdit::SearchEdit(QWidget *parent) :QLineEdit(parent){ QPixmap searchIcon(":search.png"); QLabel* lbl = new QLabel(this); lbl->setScaledContents(true); lbl->setPixmap(searchIcon); lbl->setFixedSize(QSize(21,21)); lbl->setStyleSheet("QLabel { border: none; padding: 0px; margin-left: 9px; margin-top: 8px;}"); clearButton = new QToolButton(this); QPixmap pixmap(":clear_left.png"); clearButton->setIcon(QIcon(pixmap)); clearButton->setIconSize(QSize(18,18)); clearButton->setCursor(Qt::ArrowCursor); clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; margin-right: 2px; margin-top: 3px;}"); clearButton->hide(); setAttribute(Qt::WA_MacShowFocusRect, false); connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&))); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); //setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(clearButton->sizeHint().width() + frameWidth + 1)); QSize msz = minimumSizeHint(); setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2), qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2)); }
QWidget* blProjectBrowserWidgetList::emptyListWidget(){ m_emptyListWidget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout; m_emptyListWidget->setLayout(layout); QLabel *emptyWidget = new QLabel; emptyWidget->setText(QString("<i> You have not yet created any project. </i> <br> <i> ")+ QString(" click the icon below to create a new project</i>")); layout->addWidget(emptyWidget, 0, Qt::AlignHCenter |Qt::AlignBottom); //blClickableIcon *newProjectButton = new blClickableIcon("theme/newproject.png", tr("New"), 64,64,2); QPushButton* newProjectButton = new QPushButton(this); newProjectButton->setFixedSize(64,64); newProjectButton->setObjectName("blProjectNewProjectButton"); connect(newProjectButton, SIGNAL(clicked()), this, SIGNAL(askNewProject())); layout->addWidget(newProjectButton, 0, Qt::AlignHCenter |Qt::AlignBottom); m_emptyListWidget->setFixedHeight(300); m_emptyListWidget->setFixedWidth(700); emptyWidget->setStyleSheet("QLabel{qproperty-alignment: AlignCenter;}"); m_emptyListWidget->setStyleSheet(".QWidget{border: 1px dashed black;}"); return m_emptyListWidget; }