本文整理汇总了C++中QLabel::setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setMinimumSize方法的具体用法?C++ QLabel::setMinimumSize怎么用?C++ QLabel::setMinimumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setMinimumSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AboutInherited
//-----------------------------------------------------------------------------
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 <[email protected]>\n"
"Waldo Bastian <[email protected]>");
lbl = new QLabel(str, this);
lbl->setMinimumSize(lbl->sizeHint());
box->addWidget(lbl);
box->addStretch(1000);
box->activate();
}
示例2: addIcon
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);
}
示例3: KConfigWidget
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();
}
示例4: createToolBars
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);
}
示例5: apiFqlGetPhotos
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;
}
示例6: createToolBars
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);
}
示例7: setThumbnail
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
)
);
}
示例8: setGlobalOptions
/**
* 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);
}
}
示例9: fm
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();
}
示例10: UpdateFields
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 );
}
}
}
示例11: createToolBars
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; }");
}
示例12: setChannels
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>"));
}
示例13: QLabel
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;
}
示例14: updateLegend
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();
}
示例15: getDataFromDatabase
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);
}