当前位置: 首页>>代码示例>>C++>>正文


C++ QLabel::setScaledContents方法代码示例

本文整理汇总了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; }");

}
开发者ID:CandyCoinDev,项目名称:c1,代码行数:30,代码来源:bitcoingui.cpp

示例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;
}
开发者ID:TheBCIProject,项目名称:MindWriterQt,代码行数:31,代码来源:flashablewidget.cpp

示例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));
}
开发者ID:wujingtao,项目名称:yindaojing,代码行数:31,代码来源:MainWindow.cpp

示例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);
}
开发者ID:cyclingcoin,项目名称:cyclingcoin,代码行数:30,代码来源:bitcoingui.cpp

示例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;
}
开发者ID:WeiqiJust,项目名称:CHER-Ob,代码行数:30,代码来源:aboutdlg.cpp

示例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;
}
开发者ID:coolixwebgraphics,项目名称:FRAMEWORK,代码行数:27,代码来源:tasarim_design_widget.cpp

示例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);
}
开发者ID:nodexcoin,项目名称:nodex,代码行数:31,代码来源:bitcoingui.cpp

示例8: QLabel

static QLabel *create_label(const QImage &image)
{
    QLabel *label = new QLabel();
    label->setPixmap(QPixmap::fromImage(image));
    label->setScaledContents(true);
    return label;
}
开发者ID:ddribin,项目名称:kents-nes-stuff,代码行数:7,代码来源:img2nes.cpp

示例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;
        }
    }
}
开发者ID:karusukun,项目名称:GalagaLenguajes,代码行数:31,代码来源:mainwindow.cpp

示例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();*/

}
开发者ID:kreatimont,项目名称:CourseWork_upd,代码行数:29,代码来源:mainwindow.cpp

示例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);
}
开发者ID:GitHubdeWill,项目名称:TandemTechies,代码行数:29,代码来源:menu.cpp

示例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);
}
开发者ID:LinLinYi,项目名称:kirogi,代码行数:58,代码来源:MorePage.cpp

示例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&middot;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/>"
                   "&#8226; <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/>"
                   "&#8226; <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/>"
                   "&#8226; <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/>"
                   "&#8226; <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 &lt;<a href=\"mailto:[email protected]\">[email protected]</a>&gt;<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);
}
开发者ID:lukaszmatczak,项目名称:edah,代码行数:57,代码来源:aboutdialog.cpp

示例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();
}
开发者ID:imight,项目名称:trunk,代码行数:56,代码来源:ccRenderingTools.cpp

示例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);
 }
开发者ID:OpenIndy,项目名称:OpenIndy,代码行数:10,代码来源:plugininfowidget.cpp


注:本文中的QLabel::setScaledContents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。