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


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

本文整理汇总了C++中QLabel::setFixedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setFixedWidth方法的具体用法?C++ QLabel::setFixedWidth怎么用?C++ QLabel::setFixedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QLabel的用法示例。


在下文中一共展示了QLabel::setFixedWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pixmap

SketchMainHelpPrivate::SketchMainHelpPrivate (
		const QString &viewString,
		const QString &htmlText,
		SketchMainHelp *parent)
	: QFrame()
{
	setObjectName("sketchMainHelp"+viewString);
	m_parent = parent;

	QFrame *main = new QFrame(this);
	QHBoxLayout *mainLayout = new QHBoxLayout(main);

	QLabel *imageLabel = new QLabel(this);
	QLabel *imageLabelAux = new QLabel(imageLabel);
	imageLabelAux->setObjectName(QString("inviewHelpImage%1").arg(viewString));
	QPixmap pixmap(QString(":/resources/images/helpImage%1.png").arg(viewString));
	imageLabelAux->setPixmap(pixmap);
	imageLabel->setFixedWidth(pixmap.width());
	imageLabel->setFixedHeight(pixmap.height());
	imageLabelAux->setFixedWidth(pixmap.width());
	imageLabelAux->setFixedHeight(pixmap.height());

	ExpandingLabel *textLabel = new ExpandingLabel(this);
	textLabel->setLabelText(htmlText);
	textLabel->setFixedWidth(430 - 41 - pixmap.width());
	textLabel->allTextVisible();
	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
	textLabel->setToolTip("");
	textLabel->setAlignment(Qt::AlignLeft);

	mainLayout->setSpacing(6);
	mainLayout->setMargin(2);
	mainLayout->addWidget(imageLabel);
	mainLayout->addWidget(textLabel);
	setFixedWidth(430);

	QVBoxLayout *layout = new QVBoxLayout(this);
	m_closeButton = new SketchMainHelpCloseButton(viewString,this);
	connect(m_closeButton, SIGNAL(clicked()), this, SLOT(doClose()));

	QFrame *bottomMargin = new QFrame(this);
	bottomMargin->setFixedHeight(m_closeButton->height());

	layout->addWidget(m_closeButton);
	layout->addWidget(main);
	layout->addWidget(bottomMargin);

	layout->setSpacing(0);
	layout->setMargin(2);

	m_shouldGetTransparent = false;
	//m_closeButton->doHide();

	QFile styleSheet(":/resources/styles/inviewhelp.qss");
    if (!styleSheet.open(QIODevice::ReadOnly)) {
		qWarning("Unable to open :/resources/styles/inviewhelp.qss");
	} else {
		setStyleSheet(styleSheet.readAll());
	}
}
开发者ID:h4ck3rm1k3,项目名称:fritzing,代码行数:60,代码来源:sketchmainhelp.cpp

示例2: __initializeLayoutHorizontal

QLayout* ColorDlg::__initializeLayoutHorizontal() {
  QGridLayout* pL = new QGridLayout( this, 6, 5, 5, 2); 

  pL->addWidget(new QLabel(tr( "Line"), this), 0, 0);
  pL->addWidget(pCB_Line, 0, 1);

  pL->addWidget(new QLabel(tr( "Back"), this), 1, 0);
  pL->addWidget(pCB_BGColor, 1, 1);

  pL->addWidget(new QLabel(tr( "BallLine"), this), 2, 0);
  pL->addWidget(pCB_BallLine, 2, 1);

  QLabel* pTL;
  pTL = new QLabel(this);
  pTL->setFixedWidth(30);
  pL->addWidget(pTL, 0, 2);

  pL->addMultiCellWidget(pRB_UseColorList, 0, 0, 3, 4);
  pL->addMultiCellWidget(pRB_UseSameColor, 1, 1, 3, 4);

  pTL = new QLabel(this);
  pTL->setFixedWidth(60);
  pL->addWidget(pTL, 2, 3);
  pL->addWidget(pCB_BallColor, 2, 4);

  pL->addMultiCellWidget( pOK, 5, 5, 0, 4 );

  return pL;
}
开发者ID:amiel,项目名称:jugglemaster,代码行数:29,代码来源:colordlg.cpp

示例3: QMdiSubWindow

/*!
  \brief Constructor.
  Creates a new instance of ProjectWindow.
  \param pro project data to show, not null.
  \param parent parent widgets of this window, default value is 0.
 */
Ui::ProjectWindow::ProjectWindow(Core::Project *pro, QWidget *parent /* = 0 */)
        : QMdiSubWindow(parent),
          project(pro)
{
    // entry conditions
    Q_CHECK_PTR(pro);

    setAttribute(Qt::WA_DeleteOnClose);

    setWindowIcon(QIcon(":/proj"));
    setWindowTitle(project->name());
    setMinimumSize(200, 200);

    // project view, the main widget
    view = new ProjectView(this);
    scene = new ProjectScene(project, this);
    view->setScene(scene);
    view->setSceneRect(0, 0, project->width(), project->height());
    QScrollArea* centerPanel = new QScrollArea(this);
    centerPanel->viewport()->setStyleSheet(QString("background-color:#C0C0C0"));
    centerPanel->setAlignment(Qt::AlignCenter);
    centerPanel->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    centerPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    centerPanel->setWidget(view);

    // status bar
    statusBar = new QWidget(this);
    QHBoxLayout *statusLayout = new QHBoxLayout(statusBar);
    statusLayout->setMargin(0);
    statusBar->setLayout(statusLayout);
    QLineEdit* percentInput = new QLineEdit(statusBar);
    percentInput->setText("100");
    percentInput->setFixedSize(40, 18);
    QLabel *msgLabel = new QLabel(statusBar);
    msgLabel->setText("%");
    msgLabel->setFixedWidth(8);
    QPushButton *gridButton = new QPushButton(statusBar);
    gridButton->setText("#");
    gridButton->setCheckable(true);
    gridButton->setFixedSize(20, 18);
    QLabel *ctrlLabel = new QLabel(statusBar);
    ctrlLabel->setFixedWidth(qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) - 6);
    statusLayout->addWidget(percentInput);
    statusLayout->addWidget(msgLabel);
    statusLayout->addWidget(gridButton);
    statusLayout->addWidget(centerPanel->horizontalScrollBar(), 100);
    statusLayout->addWidget(ctrlLabel);

    QWidget *mainPanel = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addWidget(centerPanel);
    mainLayout->addWidget(statusBar);
    mainPanel->setLayout(mainLayout);
    setWidget(mainPanel);

    connect(gridButton, SIGNAL(clicked(bool)), scene, SLOT(showGrid(bool)));
    connect(appCtx->mainWindow(), SIGNAL(antialiasingChanged(bool)), scene, SLOT(setAntialiasing(bool)));
}
开发者ID:jaisurya,项目名称:picworks,代码行数:66,代码来源:projectwindow.cpp

示例4: labelFont

//
//
// CButDlg Class
//
// Provide a dialog to add/edit a filter button to the MsgDialog 
//
CButDlg::CButDlg(QWidget *parent, QString name, MyButton *but)
  : QDialog(parent, name, TRUE)
{
   QBoxLayout *topLayout = new QVBoxLayout(this);
   QBoxLayout *row1Layout = new QHBoxLayout(topLayout);
   QBoxLayout *row2Layout = new QHBoxLayout(topLayout);

   QFont labelFont(font());
   labelFont.setBold(true);

   QLabel *nameLabel = new QLabel ("Name", this);
   nameLabel->setFont(labelFont);
   nameLabel->setFixedHeight(nameLabel->sizeHint().height());
   nameLabel->setFixedWidth(80);
   nameLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row1Layout->addWidget(nameLabel);
  
   QLineEdit *nameEdit = new QLineEdit (this, "Name");
   nameEdit->setText(but->text());
   nameEdit->setFont(labelFont);
   nameEdit->setFixedHeight(nameEdit->sizeHint().height());
   nameEdit->setFixedWidth(150);
   row1Layout->addWidget(nameEdit);

   QLabel *filterLabel = new QLabel ("Filter", this);
   filterLabel->setFont(labelFont);
   filterLabel->setFixedHeight(filterLabel->sizeHint().height());
   filterLabel->setFixedWidth(80);
   filterLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row2Layout->addWidget(filterLabel);
  
   QLineEdit *filterEdit = new QLineEdit (this, "Filter");
   filterEdit->setText(but->filter());
   filterEdit->setFont(labelFont);
   filterEdit->setFixedHeight(filterEdit->sizeHint().height());
   filterEdit->setFixedWidth(150);
   row2Layout->addWidget(filterEdit);

   QPushButton *ok = new QPushButton("OK", this);
   ok->setFixedWidth(30);
   ok->setFixedHeight(30);
   topLayout->addWidget(ok, 0, AlignCenter);
 
   // connect sigs
   connect(nameEdit, SIGNAL(textChanged(const QString &)),
      but, SLOT(setText(const QString &)));  
   connect(filterEdit, SIGNAL(textChanged(const QString &)),
      but, SLOT(setFilter(const QString &)));  
   connect(ok, SIGNAL(clicked()), SLOT(accept()));

   setMaximumSize(QSize(sizeHint()));
}
开发者ID:xbackupx,项目名称:showeqx,代码行数:58,代码来源:msgdlg.cpp

示例5: Initialize

// TODO(xyz): ugh, a lot of copypasta below, perhaps this could be done
// in a nice way?
void SocketsColorsFilter::Initialize(QLayout *parent, const char* caption) {
    QWidget *group = new QWidget;
    QHBoxLayout *layout = new QHBoxLayout;
    layout->setMargin(0);
    QLabel *label = new QLabel(caption);
    label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    textbox_r_ = new QLineEdit;
    textbox_r_->setPlaceholderText("R");
    textbox_g_ = new QLineEdit;
    textbox_g_->setPlaceholderText("G");
    textbox_b_ = new QLineEdit;
    textbox_b_->setPlaceholderText("B");
    layout->addWidget(label);
    layout->addWidget(textbox_r_);
    layout->addWidget(textbox_g_);
    layout->addWidget(textbox_b_);
    group->setLayout(layout);
    parent->addWidget(group);
    textbox_r_->setFixedWidth(Util::TextWidth(TextWidthId::WIDTH_RGB));
    textbox_g_->setFixedWidth(Util::TextWidth(TextWidthId::WIDTH_RGB));
    textbox_b_->setFixedWidth(Util::TextWidth(TextWidthId::WIDTH_RGB));
    label->setFixedWidth(Util::TextWidth(TextWidthId::WIDTH_LABEL));
    QObject::connect(textbox_r_, SIGNAL(textEdited(const QString&)),
                     parent->parentWidget()->window(), SLOT(OnSearchFormChange()));
    QObject::connect(textbox_g_, SIGNAL(textEdited(const QString&)),
                     parent->parentWidget()->window(), SLOT(OnSearchFormChange()));
    QObject::connect(textbox_b_, SIGNAL(textEdited(const QString&)),
                     parent->parentWidget()->window(), SLOT(OnSearchFormChange()));
}
开发者ID:Kahany,项目名称:acquisition,代码行数:31,代码来源:filters.cpp

示例6: QLabel

void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected()
{
    QLabel *label = new QLabel("Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language. Qt can also be used in several other programming languages via language bindings. It runs on all major platforms, and has extensive internationalization support. Non-GUI features include SQL database access, XML parsing, thread management, network support and a unified cross-platform API for file handling.");
    label->setWordWrap(true);
    label->setFixedWidth(200);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(label);
    layout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));

    QWidget widget;
    widget.setLayout(layout);
    widget.show();
    QTest::qWaitForWindowShown(&widget);

    int height = label->height();

    QRect g = widget.geometry();
    g.setWidth(600);
    widget.setGeometry(g);

    QTest::qWait(50);

    QCOMPARE(label->height(), height);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:25,代码来源:tst_qboxlayout.cpp

示例7: display

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();
}
开发者ID:KulerOvZuo,项目名称:SimCity,代码行数:28,代码来源:cgraphicbuildingtile.cpp

示例8: tr

QWidget *MainWindow::InstallProcessBody(){
    QString hits ="<p style='color:white; font-size:14px;'>" +
               tr("Being installed. Please wait... ") +
                  "</p>";
    QWidget *widget = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setSpacing(20);
    layout->addSpacing(70);

    DWaterProgress *iconHits = new DWaterProgress;
    layout->addWidget(iconHits);
    layout->setAlignment(iconHits, Qt::AlignCenter);
    connect(this, SIGNAL(progressChanged(int)),
            iconHits, SLOT(setProgress(int)));

    connect (this,SIGNAL(progressDone()),
             iconHits, SLOT(stop()));

    iconHits->start();

    QLabel *textHits = new QLabel;
    textHits->setAlignment(Qt::AlignCenter);
    textHits->setFixedWidth(260);
    textHits->setWordWrap(true);
    textHits->setText(hits);

    layout->addWidget(textHits);
    layout->setAlignment(textHits, Qt::AlignCenter);

    widget->setLayout(layout);
    return widget;
}
开发者ID:Abuchidefan,项目名称:deepin-windows-installer,代码行数:32,代码来源:mainwindow.cpp

示例9: QLabel

QLabel * create_label(const QString & text)
{
    QLabel * label = new QLabel(text);
    label->setFixedWidth(50);
    label->setAlignment(Qt::AlignCenter);
    return label;
}
开发者ID:LordMastodon,项目名称:voxie,代码行数:7,代码来源:editorcommon.cpp

示例10: getQLabel

QLabel* MainWindow::getQLabel()
{
    QLabel *lbl = new QLabel(this);
    lbl->setAlignment(Qt::AlignRight | Qt::AlignTop);
    lbl->setFixedWidth(LBL_WIDTH);
    return lbl;
}
开发者ID:Haraguroicha,项目名称:open-mp3-id3-tag,代码行数:7,代码来源:main_window.cpp

示例11: ChannelWidget

MainWidget::MainWidget(Widget* p_pMatrix) : ChannelWidget()
        , m_pMatrix(p_pMatrix)
{
    QVBoxLayout* layout = new QVBoxLayout;
    setLayout(layout);
    setFixedWidth(CHANNEL_WIDTH);
    layout->setSpacing(0);
    layout->setMargin(0);

    {
        QLabel *label = new QLabel(trUtf8("Phone"));
        label->setFixedWidth(CHANNEL_WIDTH);
        label->setAlignment(Qt::AlignHCenter);
        layout->addWidget(label);
    }

    phone = m_pMatrix->createRotary(OUT, MAIN, FADER, PFL);
    layout->addWidget(phone);

    {
        Widget::addSpacer(layout);
        m_pLabel = new QLabel(trUtf8("Main"));
        m_pLabel->setFixedWidth(CHANNEL_WIDTH);
        m_pLabel->setAlignment(Qt::AlignHCenter);
        layout->addWidget(m_pLabel);
        QFont font = m_pLabel->font();
        font.setBold(true);
        m_pLabel->setFont(font);
    }

    mute = m_pMatrix->createToggle(OUT, MAIN, MUTE);
    layout->addWidget(mute);
//    Widget::addLine(layout);
    {
        PixmapWidget *pw = new PixmapWidget(NULL);
        pw->setPixmap("separator.svg");
        pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT);
        layout->addWidget(pw);
    }

    mono = m_pMatrix->createRotary(OUT, MAIN, FADER, MONO);
    layout->addWidget(mono);

//    Widget::addLine(layout);
    {
        PixmapWidget *pw = new PixmapWidget(NULL);
        pw->setPixmap("separator.svg");
        pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT);
        layout->addWidget(pw);
    }

    bal = m_pMatrix->createRotary(OUT, MAIN, PAN_BAL);
    layout->addWidget(bal);

    afl = m_pMatrix->createToggle(OUT, MAIN, TO_AFL);
    layout->addWidget(afl);

    fader = m_pMatrix->createFader(OUT, MAIN, FADER, MAIN);
    layout->addWidget(fader);
}
开发者ID:LiveMix,项目名称:LiveMix,代码行数:60,代码来源:ChannelsWidgets.cpp

示例12: __initializeLayoutVertical

QLayout* ColorDlg::__initializeLayoutVertical() {
  QGridLayout* pL = new QGridLayout( this, 8, 2, 5, 2 ); 

  pL->addWidget(new QLabel(tr( "Line"), this), 0, 0);
  pL->addWidget(pCB_Line, 0, 1);

  pL->addWidget(new QLabel(tr( "Back"), this), 1, 0);
  pL->addWidget(pCB_BGColor, 1, 1);

  pL->addWidget(new QLabel(tr( "BallLine"), this), 2, 0);
  pL->addWidget(pCB_BallLine, 2, 1);

  QLabel* pTL;
  pTL = new QLabel(this);
  pTL->setFixedHeight(20);
  pL->addMultiCellWidget(pTL, 3, 3, 0, 1);

  pL->addMultiCellWidget(pRB_UseColorList, 4, 4, 0, 1);
  pL->addMultiCellWidget(pRB_UseSameColor, 5, 5, 0, 1);

  pTL = new QLabel(this);
  pTL->setFixedWidth(60);
  pL->addWidget(pTL, 6, 0);
  pL->addWidget(pCB_BallColor, 6, 1);

  pL->addMultiCellWidget( pOK, 7, 7, 0, 1 );
  return pL;
}
开发者ID:amiel,项目名称:jugglemaster,代码行数:28,代码来源:colordlg.cpp

示例13: SwitchToProcessUI

void DWindowUI::SwitchToProcessUI() {
    QLayoutItem *child;
    while ((child = actionLayout_->takeAt(0)) != 0)  {
        if (child->widget()) {
            child->widget()->setVisible(false);
        }
    }
    while ((child = selectLayout_->takeAt(0)) != 0)  {
        if (child->widget()) {
            child->widget()->setVisible(false);
        }
    }

    QLabel *processHints = new QLabel(tr("<a style='color:#ffffff; font-size:12px'>Please </a>"
                                         "<a style='color:#ebab4c; font-size:12px'>DO NOT</a>"
                                         "<a style='color:#ffffff; font-size:12px'> remove the USB flash drive or shutdown while file is writing.<a>"));
    processHints->setFixedWidth(labelMaxWidth);
    processHints->setWordWrap(true);

    selectLayout_->addStretch();
    selectLayout_->addWidget(processHints);
    selectLayout_->setAlignment(processHints, Qt::AlignVCenter);

    usbLabel_->setText("<p style='color:white; font-size:10px;'>0%  </p>");
    QMovie *processMovie = new QMovie(":/ui/images/process-active.gif");
    processLabel_->setMovie(processMovie);
    processMovie->start();

    processTimer_ = new QTimer(this);
    processTimer_->setInterval(5000);
    connect(processTimer_, SIGNAL(timeout()), this, SLOT(checkProcess()));
    processTimer_->start();

    isoLabel_->start();
}
开发者ID:LightCity,项目名称:deepin-boot-maker,代码行数:35,代码来源:dwindowui.cpp

示例14: SubSection

  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);
  }
开发者ID:Zicao,项目名称:OpenStudio,代码行数:26,代码来源:StartupView.cpp

示例15: addLayout

/*! Add a pair [label,layout] to main part of dialog, label is created from
		\b QString \b nameLabel.
\n	Recall \b addWidgetLayout(QWdiget* widget, QWdiget* layout).
*/
void Dialog::addLayout(QString labelName, QLayout *layout)
{
	QLabel *label = new QLabel(labelName);
	m_labelList.push_back(label);
	label->setFixedWidth(m_labelWidth);
	label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	addWidgetLayout(label, layout);
}
开发者ID:PsmithG,项目名称:opentoonz,代码行数:12,代码来源:dvdialog.cpp


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