//----------------------------------------------------------------------------- About::About (QWidget * aParent, const char *aName, bool aInit) : AboutInherited(aParent, aName) { QBoxLayout* box; QLabel* lbl; QFrame* frm; QString str; QFont fnt; if (aInit) return; box = new QVBoxLayout(this, 20, 6); lblTheme = new QLabel(" ", this); fnt = lblTheme->font(); fnt.setPointSize(fnt.pointSize() * 1.2); lblTheme->setFont(fnt); lblTheme->setMinimumSize(lblTheme->sizeHint()); lblTheme->setAutoResize(true); box->addWidget(lblTheme); lblVersion = new QLabel(" ", this); lblVersion->setMinimumSize(lblVersion->sizeHint()); lblVersion->setAutoResize(true); box->addWidget(lblVersion); lblAuthor = new QLabel(" ", this); lblAuthor->setMinimumSize(lblAuthor->sizeHint()); lblAuthor->setAutoResize(true); box->addWidget(lblAuthor); lblHomepage = new QLabel(" ", this); lblHomepage->setMinimumSize(lblHomepage->sizeHint()); lblHomepage->setAutoResize(true); box->addWidget(lblHomepage); frm = new QFrame(this); frm->setFrameStyle(QFrame::HLine|QFrame::Raised); box->addSpacing(5); box->addWidget(frm); box->addSpacing(5); lbl = new QLabel(i18n("KDE Theme Manager"), this); lbl->setFont(fnt); lbl->setMinimumSize(lbl->sizeHint()); box->addWidget(lbl); str.sprintf(i18n("Version %s\n\n" "Copyright (C) 1998 by\n%s\n\n" "Gnu Public License (GPL)"), KTHEME_VERSION, "Stefan Taferner <*****@*****.**>\n" "Waldo Bastian <*****@*****.**>"); lbl = new QLabel(str, this); lbl->setMinimumSize(lbl->sizeHint()); box->addWidget(lbl); box->addStretch(1000); box->activate(); }
static void addIcon(QGridLayout *mainLayout, const char *iconName) { const int atRow = mainLayout->numRows() + 1; { KIcon testIconConstr(iconName); if (testIconConstr.isNull()) { qWarning() << "KIcon " << iconName << " is NULL"; } } { QPixmap testPixmapLoader = KIconLoader::global()->loadIcon(QString(iconName), KIconLoader::NoGroup, KIconLoader::SizeHuge, KIconLoader::DefaultState, QStringList(), 0L, true ); if (testPixmapLoader.isNull()) { qWarning() << "loadIcon " << iconName << " is NULL"; } } KIcon testIcon(iconName); QPixmap testPixmap = testIcon.pixmap(64, 64); QLabel *ql = new QLabel; ql->setPixmap(testPixmap); ql->setMinimumSize(70, 70); mainLayout->addWidget(ql, atRow, 1); QLabel *qt = new QLabel; qt->setText(iconName); qt->setMinimumSize(300, 70); mainLayout->addWidget(qt, atRow, 2); mainLayout->setRowMinimumHeight(atRow, 70); }
KLocaleConfig::KLocaleConfig(QWidget *parent, const char *name) : KConfigWidget (parent, name) { QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QGridLayout *tl1 = new QGridLayout(5, 4, 5); tl->addLayout(tl1); tl->addStretch(1); gbox = new QGroupBox(klocale->translate("Language"), this); tl1->addMultiCellWidget(gbox, 0, 4, 0, 3); tl1->addRowSpacing(0, 10); tl1->addRowSpacing(4, 15); tl1->addColSpacing(0, 10); tl1->addColSpacing(3, 10); tl1->setColStretch(2, 1); changedFlag = FALSE; QLabel *label = new QLabel(klocale->translate("First"), gbox); label->setMinimumSize(label->sizeHint()); combo1 = new KLanguageCombo(gbox); combo1->setMinimumWidth(combo1->sizeHint().width()); combo1->setFixedHeight(combo1->sizeHint().height()); label->setBuddy(combo1); connect(combo1,SIGNAL(highlighted(int)),this,SLOT(changed(int))); tl1->addWidget(label, 1, 1); tl1->addWidget(combo1, 1, 2); label = new QLabel(klocale->translate("Second"), gbox); label->setMinimumSize(label->sizeHint()); combo2 = new KLanguageCombo(gbox); combo2->setMinimumWidth(combo2->sizeHint().width()); combo2->setFixedHeight(combo2->sizeHint().height()); label->setBuddy(combo2); connect(combo2,SIGNAL(highlighted(int)),this,SLOT(changed(int))); tl1->addWidget(label, 2, 1); tl1->addWidget(combo2, 2, 2); label = new QLabel(klocale->translate("Third"), gbox); label->setMinimumSize(label->sizeHint()); combo3 = new KLanguageCombo(gbox); combo3->setMinimumWidth(combo3->sizeHint().width()); combo3->setFixedHeight(combo3->sizeHint().height()); label->setBuddy(combo3); connect(combo3,SIGNAL(highlighted(int)),this,SLOT(changed(int))); tl1->addWidget(label, 3, 1); tl1->addWidget(combo3, 3, 2); tl->activate(); loadSettings(); }
void BitcoinGUI::createToolBars() { toolbar = new QToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setContextMenuPolicy(Qt::PreventContextMenu); toolbar->setObjectName("tabs"); toolbar->setStyleSheet("QToolButton { color: #ffffff; } QToolButton:hover { background-color: #050817 } QToolButton:checked { background-color: #152443 } QToolButton:pressed { background-color: #152443 } #tabs { color: #ffffff; background-color: qradialgradient(cx: -0.8, cy: 0, fx: -0.8, fy: 0, radius: 0.6, stop: 0 #404040, stop: 1 #101010); }"); QLabel* header = new QLabel(); header->setMinimumSize(48, 48); header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); header->setPixmap(QPixmap(":/icons/bitcoin")); header->setMaximumSize(48,48); header->setScaledContents(true); toolbar->addWidget(header); //QMenu *toolbarMenu = new QMenu(); toolbar->addAction(overviewAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(masternodeManagerAction); toolbar->addAction(messageAction); toolbar->setOrientation(Qt::Horizontal); toolbar->setMovable(false); addToolBar(Qt::TopToolBarArea, toolbar); }
void FbAlbumViewWidget::apiFqlGetPhotos(API::FQL::GetPhotos *method) { QList<DATA::FbPhoto *> *pList = method->getPhotos(); if (pList->size()) { buildDisplay(pList); } else // Facebook returned an empty result - hit bug { QLabel *l = new QLabel("Unfortunately we are unable to retrieve these " "photos from Facebook.<BR><BR>There is currently a bug " "in their API that causes this to occur " "and we have opened " "a ticket in their bugzilla system."); m_mainLayout->removeWidget(m_progress); delete m_progress; m_progress = 0; l->setWordWrap(true); l->setAlignment(Qt::AlignCenter); l->setMinimumSize(400,100); m_mainLayout->insertWidget(0,l,0,Qt::AlignCenter); } delete pList; delete method; }
void BitcoinGUI::createToolBars() { toolbar = new QToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setContextMenuPolicy(Qt::PreventContextMenu); toolbar->setObjectName("tabs"); toolbar->setStyleSheet("QToolButton { color: #ffffff; } } #tabs { color: #ffffff; background-color: #37c5db;}"); QLabel* header = new QLabel(); header->setMinimumSize(96, 96); header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); header->setPixmap(QPixmap(":/images/header")); header->setMaximumSize(96,96); header->setScaledContents(true); toolbar->addWidget(header); //QMenu *toolbarMenu = new QMenu(); toolbar->addAction(overviewAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->addAction(masternodeManagerAction); toolbar->addAction(richListPageAction); toolbar->addAction(messageAction); toolbar->setOrientation(Qt::Horizontal); toolbar->setMovable(false); addToolBar(Qt::TopToolBarArea, toolbar); }
void MainWindow::setThumbnail(int i) { QLabel *screenshotLabel; if (thumbnails[i] == NULL) { screenshotLabel = new QLabel; screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); screenshotLabel->setAlignment(Qt::AlignCenter); screenshotLabel->setMinimumSize(240, 160); layout->addWidget(screenshotLabel, i / 3, i % 3); thumbnails[i] = screenshotLabel; } else { screenshotLabel = thumbnails[i]; } QScreen *srn = QApplication::screens().at(0); QPixmap workspacePixmap = srn->grabWindow(QApplication::desktop()->winId()); screenshotLabel->setPixmap( workspacePixmap.scaled( screenshotLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); }
/** * Adds the specified HintingLineEdit widgets to this view. A hinting line edit * comes with a label and an algorithm's name. Headings are also shown. * @param stages : The stages, pre-process, process or post-process, as a vector * @param algNames : The algorithm names as a vector * @param hints : The hints for each algorithm as a vector */ void QDataProcessorWidget::setGlobalOptions( const std::vector<std::string> &stages, const std::vector<std::string> &algNames, const std::vector<std::map<std::string, std::string>> &hints) { // Headers QLabel *stageHeader = new QLabel(QString::fromStdString("<b>Stage</b>")); QLabel *algorithmHeader = new QLabel(QString::fromStdString("<b>Algorithm</b>")); QLabel *optionsHeader = new QLabel(QString::fromStdString("<b>Global Options</b>")); stageHeader->setMinimumHeight(30); ui.processLayout->addWidget(stageHeader, 0, 0); ui.processLayout->addWidget(algorithmHeader, 0, 1); ui.processLayout->addWidget(optionsHeader, 0, 2); int rows = static_cast<int>(stages.size()); for (int row = 0; row < rows; row++) { // The title QLabel *stageLabel = new QLabel(QString::fromStdString(stages.at(row)), this); stageLabel->setMinimumSize(100, 10); ui.processLayout->addWidget(stageLabel, row + 1, 0); // The name QLabel *nameLabel = new QLabel(QString::fromStdString(algNames.at(row)), this); ui.processLayout->addWidget(new HintingLineEdit(this, hints.at(row)), row + 1, 2); // The content ui.processLayout->addWidget(nameLabel, row + 1, 1); } }
CcaseCommentDlg::CcaseCommentDlg(bool bCheckin) : QDialog(0, "", true) { setCaption( i18n("Clearcase Comment") ); QBoxLayout *layout = new QVBoxLayout(this, 10); QLabel *messagelabel = new QLabel(i18n("Enter log message:"), this); messagelabel->setMinimumSize(messagelabel->sizeHint()); layout->addWidget(messagelabel, 0); _edit = new QMultiLineEdit(this); QFontMetrics fm(_edit->fontMetrics()); _edit->setMinimumSize(fm.width("0")*40, fm.lineSpacing()*3); layout->addWidget(_edit, 10); QBoxLayout *layout2 = new QHBoxLayout(layout); if(bCheckin) { _check = new QCheckBox(i18n("Reserve"), this); layout2->addWidget(_check); } KButtonBox *buttonbox = new KButtonBox(this); buttonbox->addStretch(); QPushButton *ok = buttonbox->addButton(KStdGuiItem::ok()); QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel()); connect(ok, SIGNAL(clicked()), SLOT(accept()) ); connect(cancel, SIGNAL(clicked()), SLOT(reject()) ); ok->setDefault(true); buttonbox->layout(); layout2->addWidget(buttonbox, 0); layout->activate(); adjustSize(); }
void wxStatusBar::UpdateFields() { // is it a good idea to recreate all the panes every update? while ( !m_qtPanes->isEmpty() ) { //Remove all panes delete m_qtPanes->takeLast(); } for (size_t i = 0; i < m_panes.GetCount(); i++) { //Set sizes int width = m_panes[i].GetWidth(); QLabel *pane = new QLabel( m_qtStatusBar ); m_qtPanes->append( pane ); if ( width >= 0 ) { //Fixed width field pane->setMinimumSize( QSize(width, 0) ); m_qtStatusBar->addWidget( pane ); } else { m_qtStatusBar->addWidget( pane, -width ); } } }
void BitcoinGUI::createToolBars() { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setObjectName("toolbar"); addToolBar(Qt::LeftToolBarArea,toolbar); toolbar->setOrientation(Qt::Vertical); toolbar->setFixedWidth(205); toolbar->setMovable( false ); toolbar->setToolButtonStyle(Qt::ToolButtonTextOnly); QLabel* header = new QLabel(); header->setMinimumSize(156,156); header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); header->setPixmap(QPixmap(":/images/header")); header->setMaximumSize(156,156); header->setContentsMargins(26,26,0,0); header->setScaledContents(true); toolbar->addWidget(header); QLabel *l = new QLabel(this); l->setPixmap(QPixmap(":/images/spacer")); toolbar->addWidget(l); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(addressBookAction); toolbar->setStyleSheet("#toolbar {background: transparent; text-align: center; color: black;padding-right: 30px;} QToolBar QToolButton:hover {background-color: transparent;} QToolBar QToolButton:selected {background-color: transparent;} QToolBar QToolButton:checked {background-color: transparent;} QToolBar QToolButton:pressed {background-color: transparent;} QToolBar QToolButton {font-family:Steps; font-size:15px; font-weight: bold; min-width:125px;max-width:125px; min-height:25px;max-height:25px; color: white; text-align: left; }"); }
void ChannelWidget::setChannels(const QList<DoubanChannel>& channels) { this->channels = channels; int curindex = 0; QList<QWidget *> labels; for (int i = 0; i < channels.size(); ++ i) { const DoubanChannel& channel = channels[i]; QLabel *label = new QLabel(ui->slider); QFont font("Sans", 12); font.setStyleStrategy(QFont::PreferAntialias); label->setFont(font); label->setText(channel.name+" MHz"); label->setStyleSheet(DARK_STYLE); label->setMinimumSize(ui->slider->width() / 3, ui->slider->height()); label->setMaximumSize(ui->slider->width() / 3, ui->slider->height()); label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); labels.append(label); if (channel.channel_id == this->channel) curindex = i; qDebug() << "Channel name=" << channel.name << " id=" << channel.channel_id; } ui->slider->setChildren(labels); ui->slider->scrollToIndex(curindex); ui->slider->currentObject()->setStyleSheet(HIGHTLIGHT_STYLE); //pnt->setText(pnt->text().replace("grey", "white").replace("<a>", "<b>").replace("</a>", "</b>")); }
QLayout *AboutDlg::initLogosLayout() { // The logos layout is horizontal. From left to right, it has // a VCG logo, vertical layout with Univ. Minho and UCSC, vertical // layout with IMSL and CHI, and vertical layout with HP and OK button. QLabel * vcgLogo = new QLabel(); vcgLogo->setMinimumSize(202, 173); vcgLogo->setPixmap(QPixmap(":/images/vcglogo.png")); vcgLogo->setAlignment(Qt::AlignTop); QLayout * universityLayout = initUniversityLayout(); QLayout * museumLayout = initMuseumLayout(); QLayout * hpButtonLayout = initHPButtonLayout(); QHBoxLayout * logosLayout = new QHBoxLayout(); logosLayout->addStretch(1); logosLayout->addWidget(vcgLogo); logosLayout->addStretch(1); logosLayout->addLayout(universityLayout); logosLayout->addStretch(1); logosLayout->addLayout(museumLayout); logosLayout->addStretch(1); logosLayout->addLayout(hpButtonLayout); logosLayout->addStretch(1); return logosLayout; }
void TimeAnalysisWidget::updateLegend() { std::vector<std::string> &labels = _selectedScalar->labels(); // removinb previous legend QFormLayout *layout = (QFormLayout *)_ui->legendGroupBox->layout(); QLayoutItem *child; while (layout->count()!=0 && (child = layout->takeAt(0)) != 0) { child->widget()->deleteLater(); delete child; } for (unsigned i=0; i<labels.size(); ++i) { QLabel *colorLabel = new QLabel; colorLabel->setAutoFillBackground(true); colorLabel->setMinimumSize(70, 15); QPalette palette = colorLabel->palette(); float denom = _selectedScalar->max() - _selectedScalar->min(); float normalizedValue = ( i - _selectedScalar->min() ) / ( denom == 0 ? 1.f : denom ); palette.setColor(colorLabel->backgroundRole(), _ui->projectionWidget->colorScale()->getColor(normalizedValue)); colorLabel->setPalette(palette); layout->addRow(new QLabel(labels[i].c_str()), colorLabel); } repaint(); }
void NotificationDialog::getDataFromDatabase(){ ui->tableWidget->setRowCount(0); bool disconnect = false; bool connected = true; if(!db.isOpen()){ disconnect = true; connected = parent->connectToDatabase(&db, false, this); } if(connected){ for(int i = 0; i < parent->cNotifications.size(); i++){ QLabel * item = new QLabel; QStringList columnNames = parent->getColumnsNames("Customers"); QVector<QStringList> retrievedData = parent->executeSelectCommand("Customers", columnNames, "ID=" + QString::number(parent->cNotifications[i].customer)); if(!retrievedData.isEmpty()){ if(!retrievedData[0].isEmpty()){ item->setText(retrievedData[columnNames.indexOf("Surname")][0] + " " + retrievedData[columnNames.indexOf("Name")][0] + " " + retrievedData[columnNames.indexOf("Patronomic")][0] + "\nТелефонный номер: (" + retrievedData[columnNames.indexOf("PhoneCode")][0] + ")" + retrievedData[columnNames.indexOf("PhoneNumber")][0] + "\nПО: " + parent->cNotifications[i].soft + "\nДата истечения лицензии: " + parent->cNotifications[i].date); QFontMetrics fontMetrics = item->fontMetrics(); QSize textSize = fontMetrics.size(0, item->text()); int textWidth = textSize.width() + 30; int textHeight = textSize.height() + 20; item->setMinimumSize(textWidth, textHeight); item->resize(textWidth, textHeight); ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1); ui->tableWidget->setCellWidget(ui->tableWidget->rowCount() - 1, 0, item); ui->tableWidget->setRowHeight(ui->tableWidget->rowCount() - 1, textHeight); } } } for(int i = 0; i < parent->lNotifications.size(); i++){ QLabel * item = new QLabel; item->setText("ПО: " + parent->lNotifications[i].soft + "\nОсталось лицензий: " + QString::number(parent->lNotifications[i].count)); QFontMetrics fontMetrics = item->fontMetrics(); QSize textSize = fontMetrics.size(0, item->text()); int textWidth = textSize.width() + 30; int textHeight = textSize.height() + 20; item->setMinimumSize(textWidth, textHeight); item->resize(textWidth, textHeight); ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1); ui->tableWidget->setCellWidget(ui->tableWidget->rowCount() - 1, 0, item); ui->tableWidget->setRowHeight(ui->tableWidget->rowCount() - 1, textHeight); } } if(disconnect) parent->disconnectFromDatabase(&db); }
void KPrWebPresentationWizard::setupPage3() { page3 = new QHBox( this ); QWhatsThis::add( page3, i18n("This page allows you to specify the colors for " "your presentation display. Select individual " "items for more help on what they do.") ); page3->setSpacing( KDialog::spacingHint() ); page3->setMargin( KDialog::marginHint() ); QLabel* sidebar = new QLabel( page3 ); sidebar->setMinimumSize( 106, 318 ); sidebar->setMaximumSize( 106, 318 ); sidebar->setFrameShape( QFrame::Panel ); sidebar->setFrameShadow( QFrame::Sunken ); sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png")); QWidget* canvas = new QWidget( page3 ); QGridLayout *layout = new QGridLayout( canvas, 6, 2, KDialog::marginHint(), KDialog::spacingHint() ); QLabel *helptext = new QLabel( canvas ); helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft ); helptext->setText( i18n( "Now you can customize the colors of the web pages." ) ); layout->addMultiCellWidget( helptext, 0, 0, 0, 1 ); layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 ); QLabel *label1 = new QLabel( i18n("Text color:"), canvas ); label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); layout->addWidget( label1, 2, 0 ); QLabel *label2 = new QLabel( i18n("Title color:"), canvas ); label2->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); layout->addWidget( label2, 3, 0 ); QLabel *label3 = new QLabel( i18n("Background color:"), canvas ); label3->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); layout->addWidget( label3, 4, 0 ); textColor = new KColorButton( webPres.getTextColor(), canvas ); layout->addWidget( textColor, 2, 1 ); titleColor = new KColorButton( webPres.getTitleColor(), canvas ); layout->addWidget( titleColor, 3, 1 ); backColor = new KColorButton( webPres.getBackColor(), canvas ); layout->addWidget( backColor, 4, 1 ); QSpacerItem* spacer = new QSpacerItem( 1, 10, QSizePolicy::Minimum, QSizePolicy::Expanding ); layout->addMultiCell( spacer, 5, 5, 0, 1 ); addPage( page3, i18n( "Step 3: Customize Colors" ) ); setHelpEnabled(page3, false); //doesn't do anything currently }
void PrefMisc::setupEditGroup(const QString& label, QLabel& labWidget, QLineEdit& edit, int row) { labWidget.setText(label); labWidget.setMinimumSize(labWidget.sizeHint()); labWidget.setBuddy(&edit); edit.setMinimumSize(edit.sizeHint()); m_grid.addWidget(&labWidget, row, 0); m_grid.addWidget(&edit, row, 1); }
PcmciaConfig::PcmciaConfig (QWidget * parent, const char *name) : KCModule(parent, name) { KAboutData *about = new KAboutData(I18N_NOOP("kcmlaptop"), I18N_NOOP("KDE Panel System Information Control Module"), 0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 1999 - 2002 Paul Campbell")); about->addAuthor("Paul Campbell", 0, "*****@*****.**"); setAboutData( about ); KGlobal::locale()->insertCatalogue("klaptopdaemon"); // For translation of klaptopdaemon messages label0 = laptop_portable::pcmcia_info(0, this); label0_text = laptop_portable::pcmcia_info(1, this); label1 = laptop_portable::pcmcia_info(2, this); label1_text = laptop_portable::pcmcia_info(3, this); QVBoxLayout *top_layout = new QVBoxLayout(this, 15, 5); QGridLayout *top_grid = new QGridLayout(2, 2); top_layout->addLayout(top_grid); top_grid->setColStretch(0, 0); top_grid->setColStretch(1, 1); top_grid->addRowSpacing(0, 40); top_grid->addRowSpacing(1, 40); label0->setFixedSize(80, 24); top_grid->addWidget(label0, 0, 0); label0_text->adjustSize(); top_grid->addWidget(label0_text, 0, 1); label1->setFixedSize(80, 24); top_grid->addWidget(label1, 1, 0); label1_text->adjustSize(); top_grid->addWidget(label1_text, 1, 1); top_layout->addStretch(1); QHBoxLayout *v1 = new QHBoxLayout; top_layout->addLayout(v1, 0); v1->addStretch(1); QString s1 = LAPTOP_VERSION; QString s2 = i18n("Version: ")+s1; QLabel* vers = new QLabel(s2, this); vers->setMinimumSize(vers->sizeHint()); v1->addWidget(vers, 0); top_layout->activate(); load(); setButtons(Help); }
//! [4] QLabel *IconPreviewArea::createPixmapLabel() { QLabel *label = new QLabel; label->setEnabled(false); label->setAlignment(Qt::AlignCenter); label->setFrameShape(QFrame::Box); label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); label->setBackgroundRole(QPalette::Base); label->setAutoFillBackground(true); label->setMinimumSize(132, 132); return label; }
FieldSelect::FieldSelect(Procview *pv, Proc *proc) : QDialog(0, "select fields"), nbuttons(proc->cats.size()), disp_fields(nbuttons), procview(pv) { QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); updating = FALSE; setCaption("qps: select fields"); buts = new QCheckBox*[nbuttons]; QGridLayout *l1 = new QGridLayout((nbuttons + 1) / 2, 5, 0); tl->addLayout(l1, 1); l1->addColSpacing(2, 15); int half = (nbuttons + 1) / 2; for(int i = 0; i < nbuttons; i++) { QCheckBox *but = new QCheckBox(proc->cats[i]->name, this); QLabel *desc = new QLabel(proc->cats[i]->help, this); but->setMinimumSize(but->sizeHint()); desc->setMinimumSize(desc->sizeHint()); if(i < half) { l1->addWidget(but, i, 0); l1->addWidget(desc, i, 1); } else { l1->addWidget(but, i-half, 3); l1->addWidget(desc, i-half, 4); } buts[i] = but; connect(but, SIGNAL(toggled(bool)), this, SLOT(field_toggled(bool))); } update_boxes(); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); QPushButton *closebut = bbox->addButton(i18n("Close")); closebut->setDefault(TRUE); closebut->setFocus(); closebut->setFixedSize(closebut->sizeHint()); bbox->layout(); tl->addWidget(bbox); connect(closebut, SIGNAL(clicked()), SLOT(closed())); QAccel *acc = new QAccel(this); acc->connectItem(acc->insertItem(CTRL + Key_W), this, SLOT(closed())); tl->freeze(); }
void MainWindow::initStatusbar() { // QProgressBar *progressBar = new QProgressBar(); QLabel *mode = new QLabel( tr(" Ready ") ); int counts = ui->contactTableView->groupContactCounts(GROUP_DEFAULT); m_countLb = new QLabel( tr(" Contact(s): %1 ").arg(counts) ); m_musciPlayBtn = new QPushButton(tr("")); m_statustimeLb = new QLabel( tr(" Time: 0000/00/00 00:00:00") ); mode->setMinimumSize( mode->sizeHint() ); mode->setAlignment( Qt::AlignCenter ); mode->setText( tr("Ready") ); mode->setToolTip( tr("The current working mode.") ); m_countLb->setMinimumSize( m_countLb->sizeHint() ); m_countLb->setAlignment( Qt::AlignCenter ); m_countLb->setToolTip( tr("Current contacts count(s): %1 ").arg(counts) ); m_musciPlayBtn->setCheckable(true); m_musciPlayBtn->setChecked(true); m_musciPlayBtn->setMinimumSize( QSize(20, 20) ); m_musciPlayBtn->setIcon(QIcon(":/icons/green/sound.png")); int id = Global::g_preferences->m_backmusicId; QString msic = Global::g_preferences->m_backmusics.at(id); QFileInfo fi(msic); m_musciPlayBtn->setToolTip( tr("Background music is playing: %1").arg(fi.fileName())); connect( m_musciPlayBtn, SIGNAL(toggled(bool)), this, SLOT(updateStatusbarPlay(bool)) ); connect( m_musciPlayBtn, SIGNAL(toggled(bool)), Global::g_settingMusic, SLOT(musicPlay(bool)) ); connect( Global::g_settingMusic, SIGNAL(updatePlayBtn(bool)), this, SLOT(updateStatusbarPlay(bool)) ); QTimer * timer = new QTimer(); int sec = 1; QObject::connect(timer,SIGNAL(timeout()), this, SLOT(updateStatusbarTime())); timer->start(sec * 1000); m_statustimeLb->setMinimumSize( m_statustimeLb->sizeHint() ); m_statustimeLb->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); m_statustimeLb->setToolTip( tr("Current system time.") ); ui->statusBar->addWidget( mode ); ui->statusBar->addWidget( m_countLb ); ui->statusBar->addWidget(m_musciPlayBtn); ui->statusBar->addWidget(m_statustimeLb); ui->statusBar->addPermanentWidget( m_musciPlayBtn );//现实永久信息 ui->statusBar->addPermanentWidget( m_statustimeLb );//现实永久信息 }
IconPreview::IconPreview(QWidget *parent) : FilePreview(parent) { icons = NULL; QGridLayout *lay = new QGridLayout(this, 4, 4); lay->setMargin(4); lay->setSpacing(4); for (unsigned i = 0; i < 5; i++){ for (unsigned j = 0; j < 4; j++){ QLabel *l = new QLabel(this); l->setMinimumSize(QSize(22, 22)); labels[i * 4 + j] = l; lay->addWidget(l, i, j); } } }
void CLogisticMainWindow::setupStatusBar(const bool &visible) { if (!visible) return; statusBar()->setVisible(visible); QDate *d = new QDate(); QLabel *labelDate = new QLabel(" Дата: <b>" + d->currentDate().toString("ddd, dd/MM/yyyy г. ") + "</b>\t"); labelDate->setMinimumSize(labelDate->sizeHint()); QLabel *labelDatabase = new QLabel(" База данных: <b>" + CLogisticApplication::instance()->dbname() + "</b>\t"); statusBar()->addWidget(labelDate); statusBar()->addWidget(labelDatabase); }
void DarkSilkGUI::createToolBars() { QLabel* header = new QLabel(); header->setMinimumSize(48, 48); header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); header->setPixmap(QPixmap(":/icons/darksilk")); header->setMaximumSize(48, 48); header->setScaledContents(true); toolbar = new QToolBar(tr("Tabs toolbar")); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->setContextMenuPolicy(Qt::PreventContextMenu); toolbar->setObjectName("tabs"); toolbar->setStyleSheet("#tabs { background-color: qradialgradient(cx: -0.8, cy: 0, fx: -0.8, fy: 0, radius: 0.6, stop: 0 #000000, stop: 1 #000000); }"); toolbar->addWidget(header); QMenu *toolbarMenu = new QMenu(); toolbarMenu->addAction(overviewAction); toolbarMenu->addAction(receiveCoinsAction); toolbarMenu->addAction(sendCoinsAction); toolbarMenu->addAction(historyAction); toolbarMenu->addAction(addressBookAction); toolbarMenu->addAction(statisticsAction); toolbarMenu->addAction(blockAction); toolbarMenu->addAction(stormnodeManagerAction); QAction* menuAction = new QAction(QIcon(":/icons/overview"), tr("&Menu"), this); menuAction->setToolTip(tr("Access DarkSilk Wallet Tabs")); menuAction->setCheckable(false); QToolButton* menuToolButton = new QToolButton(); menuToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly); menuToolButton->setMenu(toolbarMenu); menuToolButton->setPopupMode(QToolButton::InstantPopup); menuToolButton->setDefaultAction(menuAction); netLabel = new QLabel(); netLabel->setObjectName("netLabel"); netLabel->setStyleSheet("#netLabel { color: #ffffff; }"); toolbar->addWidget(menuToolButton); toolbar->addWidget(makeToolBarSpacer()); toolbar->addWidget(netLabel); toolbar->setOrientation(Qt::Horizontal); toolbar->setMovable(false); addToolBar(Qt::TopToolBarArea, toolbar); }
SmilePreview::SmilePreview(QWidget *parent) : FilePreview(parent) { smiles = NULL; QGridLayout *lay = new QGridLayout(this, 4, 4); lay->setMargin(4); lay->setSpacing(4); for (unsigned i = 0; i < 5; i++){ for (unsigned j = 0; j < 4; j++){ QLabel *l = new QLabel(this); l->setMinimumSize(QSize(22, 22)); l->setFrameStyle(QFrame::Box); l->setLineWidth(2); labels[i * 4 + j] = l; lay->addWidget(l, i, j); } } }
void BusyIndicator::Init(const QString& text) { movie_ = new QMovie(":spinner.gif"), label_ = new QLabel; QLabel* icon = new QLabel; icon->setMovie(movie_); icon->setMinimumSize(16, 16); label_->setWordWrap(true); label_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QHBoxLayout* layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(icon); layout->addSpacing(6); layout->addWidget(label_); set_text(text); }
void KFilePreview::init( KFileView *view ) { setViewName( i18n("Preview") ); left = 0L; setFileView( view ); preview = new QWidget((QSplitter*)this, "preview"); QString tmp = i18n("No preview available."); QLabel *l = new QLabel(tmp, preview); l->setMinimumSize(l->sizeHint()); l->move(10, 5); preview->setMinimumWidth(l->sizeHint().width()+20); setResizeMode(preview, QSplitter::KeepSize); // Why copy the actions? --ellis, 13 Jan 02. //for ( uint i = 0; i < view->actionCollection()->count(); i++ ) // actionCollection()->insert( view->actionCollection()->action( i )); }
void KexiPasswordWidget::addCommentLine( const QString& label, const QString& comment ) { int gridMarginLeft, gridMarginTop, gridMarginRight, gridMarginBottom; d->ui.formLayout->getContentsMargins(&gridMarginLeft, &gridMarginTop, &gridMarginRight, &gridMarginBottom); int spacing = d->ui.formLayout->horizontalSpacing(); if (spacing < 0) { // same inter-column spacing for all rows, see comment in qformlayout.cpp spacing = style()->combinedLayoutSpacing(QSizePolicy::Label, QSizePolicy::LineEdit, Qt::Horizontal, 0, this); } QLabel* c = new QLabel(comment, this); c->setWordWrap(true); d->ui.formLayout->insertRow(d->commentRow, label, c); ++d->commentRow; // cycle through column 0 widgets and see the max width so we can set the minimum height of // column 2 wordwrapable labels int firstColumnWidth = 0; for (int i = 0; i < d->ui.formLayout->rowCount(); ++i) { QLayoutItem *li = d->ui.formLayout->itemAt(i, QFormLayout::LabelRole); if (li) { QWidget *w = li->widget(); if (w && !w->isHidden()) { firstColumnWidth = qMax(firstColumnWidth, w->sizeHint().width()); } } } for (int i = 0; i < d->ui.formLayout->rowCount(); ++i) { QLayoutItem *li = d->ui.formLayout->itemAt(i, QFormLayout::FieldRole); if (li) { QLabel *l = qobject_cast<QLabel*>(li->widget()); if (l && l->wordWrap()) { int w = sizeHint().width() - firstColumnWidth - ( 2 * KDialog::marginHint() ) - gridMarginLeft - gridMarginRight - spacing; l->setMinimumSize( w, l->heightForWidth(w) ); } } } }
void TIA::createViews() { wCentral = new QTabWidget(this); setCentralWidget(wCentral); m_VLog = new VLog(); m_VLog->setWindowIcon(QIcon(":/icons/images/blue-folders-stack.png")); QLabel *lblRightStatusbar = new QLabel( tr(" EDIT ") ); lblRightStatusbar->setMinimumSize( lblRightStatusbar->sizeHint() ); lblRightStatusbar->setAlignment( Qt::AlignCenter ); lblRightStatusbar->setText( tr("v0.0.1alpha") ); lblRightStatusbar->setToolTip( tr("The current working mode.") ); m_StatusBar->addPermanentWidget(lblRightStatusbar); m_StatusBar->showMessage( tr("Ready"), 2000 ); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { setWindowFlags(Qt::WindowCloseButtonHint); ui->setupUi(this); QStatusBar *statusBar = this->statusBar(); QLabel *mode = new QLabel( tr(" Time ") ); mode->setMinimumSize( mode->sizeHint() ); mode->setAlignment( Qt::AlignCenter ); mode->setText( tr("Ready") ); mode->setToolTip( tr("The current working mode.") ); statusBar->addPermanentWidget( mode ); connect(ui->tableWidget_resultat,SIGNAL(clicked(QModelIndex)),this,SLOT(modifierPatient(QModelIndex))); connect(ui->lineEdit_search,SIGNAL(editingFinished()),this,SLOT(on_btn_search_clicked())); this->setWidget(); this->afficherRess(); this->on_btn_search_clicked(); statusBar->showMessage( tr("Ready!!")); }