本文整理汇总了C++中QLabel::setScaledContents方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setScaledContents方法的具体用法?C++ QLabel::setScaledContents怎么用?C++ QLabel::setScaledContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setScaledContents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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; }");
}
示例2: f
FlashableWidget::FlashableWidget(int width, int height, QWidget *parent):
QWidget(parent) ,vLabels_(), width_(width), height_(height),
vActiveLabels_(), inactiveLabelPalette(), activeLabelPalette(),
backgroundPalette(), currentHalve(0), selectedHalveWidth(0),
selectedHalveHeight(0), firstHalveWidth(0), firstHalveHeight(0),
secondHalveWidth(0), secondHalveHeight(0)
{
grid = new QGridLayout;
QFont f("Helvetica", 20);
for(int row = 0; row < height_; ++row)
{
for(int column = 0; column < width_; ++column)
{
QLabel *label = new QLabel();
label->setFont(f);
label->setScaledContents(true);
label->setFrameShape(QFrame::Box);
label->setLineWidth(3);
label->setAlignment(Qt::AlignCenter);
label->setPalette(inactiveLabelPalette);
label->setAutoFillBackground(true);
grid->addWidget(label, row, column);
vLabels_.push_back(label);
}
}
setLayout(grid);
oneByOneIndex_ = 0;
}
示例3: loadNewImage
void MainWindow::loadNewImage(QString pathName)
{
if(sa == NULL)
{return;}
FileCentre *fc = FileCentre::GetInstance();
QString path = fc->GetRecordPath();
QDir dir(path);
QStringList filter;
filter<<"*.png"<<"*.jpg"<<"*.bmp";
dir.setNameFilters(filter);
int iNum = dir.count();
if(iNum < 1)
{return;}
//MyLabel *lb = new MyLabel(mLW, pathName);
QLabel *lb = WidgetFactory::GetLabel(mLW, pathName);
lb->setGeometry(QRect(10, (iNum-1)*190, 180, 180));
lb->setPixmap(pathName);
lb->setScaledContents(true);
lb->show();
/*
sa->setWidget(mLW);
sa->setGeometry(0,0, 210, 820);
mLW->setGeometry(0,0,190,190*(iNum+1));
mLW->show();
sa->show();
*/
mLW->setGeometry(0,0,190,190*(iNum+1));
}
示例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: QLabel
QLayout *AboutDlg::initTitleLayout()
{
// The title layout has the product title, a picture, a horizontal
// user guide layout, and a GPL 3 label.
titleLabel = new QLabel();
titleLabel->setMaximumSize(250, 64);
titleLabel->setAlignment(Qt::AlignCenter);
QLabel * tombImage = new QLabel();
tombImage->setMaximumSize(250, 250);
tombImage->setPixmap(QPixmap(":/images/tomb.png"));
tombImage->setScaledContents(true);
tombImage->setAlignment(Qt::AlignCenter);
gplLabel = new QLabel();
gplLabel->setMaximumSize(250, 32);
gplLabel->setAlignment(Qt::AlignCenter);
QVBoxLayout * titleLayout = new QVBoxLayout();
titleLayout->setSpacing(15);
titleLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding));
titleLayout->addWidget(titleLabel);
titleLayout->addWidget(tombImage);
titleLayout->addLayout(initUserGuideLayout());
titleLayout->addWidget(gplLabel);
titleLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding));
return titleLayout;
}
示例6: QLabel
QLabel * TASARIM_DESIGN_WIDGET::CREATE_NEW_LABEL ( const QString &text, QWidget * parent )
{
if ( parent EQ NULL ) {
parent = this;
}
QLabel * label = new QLabel(text.toUtf8(),parent);
label->setMargin(0);
label->setIndent(0);
QFont label_font = label->font();
label_font.setFixedPitch ( false );
label_font.setKerning ( false );
label_font.setLetterSpacing ( QFont::AbsoluteSpacing, 0.01 );
label_font.setWordSpacing ( 0.01 );
label->setScaledContents ( true );
label->setFont ( label_font );
label->setFocusPolicy ( Qt::StrongFocus );
int width = label->width();
label->setMinimumWidth( width + 5 );
label->installEventFilter( this );
SET_LABEL_FONTS_UNSELECTED( label );
return label;
}
示例7: 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);
}
示例8: QLabel
static QLabel *create_label(const QImage &image)
{
QLabel *label = new QLabel();
label->setPixmap(QPixmap::fromImage(image));
label->setScaledContents(true);
return label;
}
示例9: refreshScore
void MainWindow::refreshScore()
{
if(enemyKilled)
{
enemyKilled = false;
int num = player->score;
clearScore();
do
{
int index = num%10;
num /= 10;
QPixmap temp(this->numbers[index]);
QLabel* templbl = new QLabel();
templbl->setPixmap(temp);
templbl->setFixedSize(15,15);
templbl->setScaledContents(true);
templbl->setParent(this);
scoreNumbers->append(templbl);
}while(num != 0);
int start = 30 + (30* scoreNumbers->size());
for(int i = 0; i < scoreNumbers->size(); i++)
{
scoreNumbers->at(i)->move(start, 30);
scoreNumbers->at(i)->show();
start -=30;
}
}
}
示例10: QLabel
void MainWindow::on_actionQueue3_triggered() //Show Sky Map
{
/*QDialog * dial = new QDialog;
dial->setBaseSize(1300,800);
dial->setWindowTitle("Sky map");
//dial->setStyleSheet("background: url(:/new/prefix1/skymap_source.png)");*/
QLabel *image = new QLabel();
image->setPixmap( QPixmap( ":/new/prefix1/skymap_source.png" ) );
image->setBackgroundRole(QPalette::Base);
image->setBaseSize(1200,800);
image->setScaledContents(true);
QScrollArea * scrollArea = new QScrollArea;
//scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setBaseSize(1200,800);
scrollArea->setWidget(image);
scrollArea->setWindowTitle("Sky map");
scrollArea->show();
//setCentralWidget(scrollArea);
/*QVBoxLayout * mainLayout = new QVBoxLayout();
dial->setLayout(mainLayout);
dial->exec();*/
}
示例11: icon
Menu::Menu(QWidget *parent) :
QWidget(parent),
ui(new Ui::Menu)
{
ui->setupUi(this);
setWindowFlags(Qt::WindowStaysOnTopHint);
setWindowModality(Qt::ApplicationModal);
setWindowTitle("Tandem Techies");
setFixedSize(geometry().width(), geometry().height());
QIcon icon(":/images/player.png");
setWindowIcon(icon);
QLabel* background = new QLabel(this);
QPixmap backgroundImg(":/images/bg.png");
background->setPixmap(backgroundImg);
background->setGeometry(0, 0, geometry().width(), geometry().height());
background->setScaledContents(true);
background->lower();
background->show();
//Make the logo's background transparent
ui->lblLogo->setAttribute(Qt::WA_TranslucentBackground);
//Make the menu border invisible
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint);
setWindowFlags(Qt::CustomizeWindowHint);
setWindowFlags(Qt::FramelessWindowHint);
}
示例12: initializeWidget
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);
}
示例13: QLabel
AboutDialog::AboutDialog()
{
this->setWindowTitle(tr("About"));
QGridLayout *layout = new QGridLayout;
this->setLayout(layout);
QLabel *icon = new QLabel(this);
icon->setPixmap(QIcon(":/img/icon.svg").pixmap(QSize(128, 128)));
icon->setFixedSize(128, 128);
icon->setScaledContents(true);
layout->addWidget(icon, 0, 0, 2, 1, Qt::AlignTop);
QLabel *text = new QLabel(this);
text->setText(QString("<b>Edah %1</b><br/>").arg(utils->getAppVersion()) +
"<br/>" +
tr("Edah (heb. ʽe·dhahʹ, eng. assembly) - program that handles multimedia during meetings. "
"Edah can be extended by plugins (for example: \"Player\", \"Recorder\", \"Stream\"), "
"supports touchscreen and is fully configurable.<br/>") +
"WWW: <a href=\"http://edah.tk\">edah.tk</a>");
text->setOpenExternalLinks(true);
text->setWordWrap(true);
layout->addWidget(text, 0, 1);
QLabel *text2 = new QLabel(this);
text2->setText("<br/>"
"This software contains:<br/>"
"• <a href=\"http://www.typicons.com/\">Typicons</a> by Stephen Hutchings licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\">CC BY-SA</a><br/>"
"• <a href=\"https://www.openssl.org/\">OpenSSL</a> by The OpenSSL Project licensed under <a href=\"https://raw.githubusercontent.com/openssl/openssl/master/LICENSE\">OpenSSL License</a><br/>"
"• <a href=\"https://github.com/qtproject/qt-solutions/tree/master/qtsingleapplication\">QtSingleApplication</a> by Digia Plc and/or its subsidiary(-ies) licensed under BSD license<br/>"
"• <a href=\"http://www.google.com/fonts/specimen/Open+Sans\">Open Sans</a> by Steve Matteson licensed under <a href=\"http://www.apache.org/licenses/LICENSE-2.0\">Apache License 2.0</a><br/>"
"<br/>");
text2->setOpenExternalLinks(true);
text2->setWordWrap(false);
layout->addWidget(text2, 1, 1);
QLabel *text3 = new QLabel(this);
text3->setText("This application uploads to update server data such as unique device ID, "
"version of your operating system and IP address.<br/><br/>"
"Copyright (C) 2016-2017 Łukasz Matczak <<a href=\"mailto:[email protected]\">[email protected]</a>><br/>"
"This program comes with ABSOLUTELY NO WARRANTY. This is "
"free software, and you are welcome to redistribute it under "
"certain conditions; ");
#ifdef Q_OS_WIN
text3->setText(text3->text() +
"<a href=\"LICENSE.txt\">click here</a> for details.");
#endif
text3->setOpenExternalLinks(true);
text3->setWordWrap(true);
layout->addWidget(text3, 2, 1);
QDialogButtonBox *btns = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeBtn = btns->button(QDialogButtonBox::Close);
closeBtn->setText(tr("Close"));
connect(closeBtn, &QPushButton::clicked, this, &AboutDialog::close);
layout->addWidget(btns, 3, 0, 1, 2);
}
示例14: ShowDepthBuffer
void ccRenderingTools::ShowDepthBuffer(ccGBLSensor* sensor, QWidget* parent)
{
if (!sensor)
return;
const ccGBLSensor::DepthBuffer& depthBuffer = sensor->getDepthBuffer();
if (!depthBuffer.zBuff)
return;
//determine min and max depths
ScalarType minDist = 0, maxDist = 0;
{
const ScalarType *_zBuff = depthBuffer.zBuff;
for (int x=0; x<depthBuffer.height*depthBuffer.width; ++x,++_zBuff)
{
if (x==0)
{
maxDist = minDist = *_zBuff;
}
else if (*_zBuff > 0)
{
maxDist = std::max(maxDist,*_zBuff);
minDist = std::min(minDist,*_zBuff);
}
}
}
QImage bufferImage(depthBuffer.width,depthBuffer.height,QImage::Format_RGB32);
{
ccColorScale::Shared colorScale = ccColorScalesManager::GetDefaultScale();
assert(colorScale);
ScalarType coef = maxDist-minDist < ZERO_TOLERANCE ? 0 : static_cast<ScalarType>(ccColorScale::MAX_STEPS-1)/(maxDist-minDist);
const ScalarType* _zBuff = depthBuffer.zBuff;
for (int y=0; y<depthBuffer.height; ++y)
{
for (int x=0; x<depthBuffer.width; ++x,++_zBuff)
{
const colorType* col = (*_zBuff >= minDist ? colorScale->getColorByIndex(static_cast<unsigned>((*_zBuff-minDist)*coef)) : ccColor::black);
bufferImage.setPixel(x,depthBuffer.height-1-y,qRgb(col[0],col[1],col[2]));
}
}
}
QDialog* dlg = new QDialog(parent);
dlg->setWindowTitle(QString("%0 depth buffer [%1 x %2]").arg(sensor->getParent()->getName()).arg(depthBuffer.width).arg(depthBuffer.height));
dlg->setFixedSize(bufferImage.size());
QVBoxLayout* vboxLayout = new QVBoxLayout(dlg);
vboxLayout->setContentsMargins(0,0,0,0);
QLabel* label = new QLabel(dlg);
label->setScaledContents(true);
vboxLayout->addWidget(label);
label->setPixmap(QPixmap::fromImage(bufferImage));
dlg->show();
}
示例15: foreach
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);
}