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


C++ QSizePolicy::setHeightForWidth方法代码示例

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


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

示例1: myPalette

ChatWidget::ChatWidget(QWidget *parent) : QScrollArea(parent), ui(new Ui::ChatWidget) {
    ui->setupUi(this);

	this->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
	this->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded);

	QSizePolicy selfSizePolicy = this->sizePolicy();
	selfSizePolicy.setHeightForWidth(true);
	this->setSizePolicy(selfSizePolicy);
	this->setWidgetResizable(true);
	
	QSizePolicy contentsSizePolicy = ui->scrollAreaWidgetContents->sizePolicy();
	contentsSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
	contentsSizePolicy.setVerticalPolicy(QSizePolicy::Expanding);
	contentsSizePolicy.setHeightForWidth(true);
	ui->scrollAreaWidgetContents->setSizePolicy(contentsSizePolicy);
	ui->scrollAreaWidgetContents->setMinimumWidth(400);

	this->setWidget(ui->scrollAreaWidgetContents);

	topLayout = new QVBoxLayout();
	ui->scrollAreaWidgetContents->setLayout(topLayout);

	QPalette myPalette(palette());
	myPalette.setColor(QPalette::Background, Qt::white);
	this->setAutoFillBackground(true);
	this->setPalette(myPalette);
}
开发者ID:dbrgn,项目名称:openMittsu,代码行数:28,代码来源:ChatWidget.cpp

示例2: sizeof

EmulLCD::EmulLCD(QWidget *parent) :
	QFrame(parent),
	fg_color(LCD_FG_COLOR),
	bg_brush(QColor(LCD_BG_COLOR))
{
	// Optimized rendering: we repaint everything anyway
	setAttribute(Qt::WA_NoSystemBackground);

	// initialize bitmap
	memset(raster, 0xAA, sizeof(raster));

	// set widget frame
	setFrameStyle(QFrame::Panel | QFrame::Sunken);
	frame_width = frameWidth();

	setMinimumSize(WIDTH + frame_width * 2, HEIGHT + frame_width * 2);

	#if CONFIG_EMULLCD_SCALE
		QSizePolicy pol = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred, QSizePolicy::Frame);
		pol.setHeightForWidth(true);
	#else
		QSizePolicy pol = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed, QSizePolicy::Frame);
	#endif
	setSizePolicy(pol);
}
开发者ID:7h0ma5,项目名称:kiss-avraprs,代码行数:25,代码来源:lcd_gfx_qt.cpp

示例3: sizePolicy

VBoxSettingsTreeViewSelector::VBoxSettingsTreeViewSelector (QWidget *aParent /* = NULL */)
    :VBoxSettingsSelector (aParent)
{
    mTwSelector = new QITreeWidget (aParent);
    /* Configure the selector */
    QSizePolicy sizePolicy (QSizePolicy::Minimum, QSizePolicy::Expanding);
    sizePolicy.setHorizontalStretch (0);
    sizePolicy.setVerticalStretch (0);
    sizePolicy.setHeightForWidth (mTwSelector->sizePolicy().hasHeightForWidth());
    const QStyle *pStyle = QApplication::style();
    const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
    mTwSelector->setSizePolicy (sizePolicy);
    mTwSelector->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
    mTwSelector->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
    mTwSelector->setRootIsDecorated (false);
    mTwSelector->setUniformRowHeights (true);
    mTwSelector->setIconSize(QSize((int)(1.5 * iIconMetric), (int)(1.5 * iIconMetric)));
    /* Add the columns */
    mTwSelector->headerItem()->setText (treeWidget_Category, "Category");
    mTwSelector->headerItem()->setText (treeWidget_Id, "[id]");
    mTwSelector->headerItem()->setText (treeWidget_Link, "[link]");
    /* Hide unnecessary columns and header */
    mTwSelector->header()->hide();
    mTwSelector->hideColumn (treeWidget_Id);
    mTwSelector->hideColumn (treeWidget_Link);
    /* Setup connections */
    connect (mTwSelector, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
             this, SLOT (settingsGroupChanged (QTreeWidgetItem *, QTreeWidgetItem*)));
}
开发者ID:jeppeter,项目名称:vbox,代码行数:29,代码来源:VBoxSettingsSelector.cpp

示例4: sizePolicy

FlowLayout::FlowLayout()
{
    m_spacing[0] = 6;
    m_spacing[1] = 6;
    QSizePolicy sp = sizePolicy();
    sp.setHeightForWidth(true);
    setSizePolicy(sp);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:8,代码来源:flowlayout.cpp

示例5: QWidget

HFWWidget::HFWWidget()
    : QWidget()
{
    setMinimumSize(QSize(100,50));
    QSizePolicy s = sizePolicy();
    s.setHeightForWidth(true);
    setSizePolicy(s);
}
开发者ID:maxxant,项目名称:qt,代码行数:8,代码来源:tst_qscrollarea.cpp

示例6:

QtMeasuringEditorDialogue::QtMeasuringEditorDialogue(QWidget * parent, const char * name, bool modal, Qt::WFlags f, QString appPath) 
:Q3TabDialog(parent, name, modal,f)
{
	apppath = appPath;
	QSizePolicy sizepolicy;
	sizepolicy.setHeightForWidth(TRUE);
	setSizePolicy(sizepolicy);
 
	setCaption("Measuring Editor");
	//setIcon( QPixmap( "Icons/ruler.png" ));

	build_layout();
}
开发者ID:ut666,项目名称:VolViewer,代码行数:13,代码来源:QtMeasuringEditorDialogue.cpp

示例7: ChatWidgetItem

TextChatWidgetItem::TextChatWidgetItem(Contact* contact, ContactIdWithMessageId const& senderAndMessageId, QString const& message, QWidget *parent) : ChatWidgetItem(contact, senderAndMessageId, parent), ui(new Ui::TextChatWidgetItem), message(message) {
	ui->setupUi(this);

	QSizePolicy sp = this->sizePolicy();
	sp.setHeightForWidth(true);
	this->setSizePolicy(sp);

	ui->lblMessageText->setText(preprocessLinks(message));
	ui->lblMessageText->setWordWrap(true);
	ui->lblFromTime->setWordWrap(true);

	onDataUpdated();
}
开发者ID:Blinket,项目名称:openMittsu,代码行数:13,代码来源:TextChatWidgetItem.cpp

示例8: ChatWidgetItem

LocationChatWidgetItem::LocationChatWidgetItem(Contact* contact, ContactIdWithMessageId const& senderAndMessageId, QDateTime const& timeSend, QDateTime const& timeReceived, double latitude, double longitude, double height, QString const& description, QWidget *parent) : ChatWidgetItem(contact, senderAndMessageId, timeSend, timeReceived, parent), ui(new Ui::LocationChatWidgetItem), latitude(latitude), longitude(longitude), height(height), description(description) {
	ui->setupUi(this);

	QSizePolicy sp = this->sizePolicy();
	sp.setHeightForWidth(true);
	this->setSizePolicy(sp);

	QString const locationUrl = QString(QStringLiteral("https://maps.google.com/?q=%1,%2")).arg(latitude).arg(longitude);
	ui->lblMessageText->setText(QString("Location: <a href=\"%1\">%1</a> - %2").arg(locationUrl).arg(description));
	ui->lblMessageText->setWordWrap(true);
	ui->lblFromTime->setWordWrap(true);

	onDataUpdated();
}
开发者ID:Blinket,项目名称:openMittsu,代码行数:14,代码来源:LocationChatWidgetItem.cpp

示例9: QWidget

MiniMap::MiniMap(const QPixmap& overview, QWidget *parent) 
  : QWidget(parent),
    _overview(overview),
    _fieldOfView(QRectF()),
    _aspectRatio(1),
    _manager(NULL),
    _drawCoverageMap(true)
{
  QSizePolicy policy;
  policy.setHeightForWidth(true);
  policy.setHorizontalPolicy(QSizePolicy::Fixed);
  policy.setVerticalPolicy(QSizePolicy::Fixed);
  setSizePolicy(policy);
  if (!overview.isNull()) {
    _aspectRatio = static_cast<float>(_overview.width()) / _overview.height();
  }
}
开发者ID:GeertLitjens,项目名称:ASAP,代码行数:17,代码来源:MiniMap.cpp

示例10: setWordWrap

void DNotificationWidget::setWordWrap(bool wordWrap)
{
    d->wordWrap = wordWrap;
    d->textLabel->setWordWrap(wordWrap);
    QSizePolicy policy = sizePolicy();
    policy.setHeightForWidth(wordWrap);
    setSizePolicy(policy);
    d->updateLayout();

    // Without this, when user does wordWrap -> !wordWrap -> wordWrap, a minimum
    // height is set, causing the widget to be too high.
    // Mostly visible in test programs.
    if (wordWrap)
    {
        setMinimumHeight(0);
    }
}
开发者ID:KDE,项目名称:digikam,代码行数:17,代码来源:dnotificationwidget.cpp

示例11: heightForWidth

void tst_QGraphicsLinearLayout::heightForWidth()
{
    QFETCH(bool, hfw);
    QFETCH(bool, nested);

    QGraphicsScene scene;
    QGraphicsWidget *form = new QGraphicsWidget;
    scene.addItem(form);

    QGraphicsLinearLayout *outerlayout = 0;
    if (nested) {
       outerlayout = new QGraphicsLinearLayout(form);
       for (int i = 0; i < 8; i++) {
           QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
           outerlayout->addItem(layout);
           outerlayout = layout;
       }
    }

    QGraphicsLinearLayout *qlayout = 0;
    qlayout = new QGraphicsLinearLayout(Qt::Vertical);
    if (nested)
        outerlayout->addItem(qlayout);
    else
        form->setLayout(qlayout);

    MySquareWidget *widget = new MySquareWidget;
    for (int i = 0; i < 1; i++) {
        widget = new MySquareWidget;
        QSizePolicy sizepolicy = widget->sizePolicy();
        sizepolicy.setHeightForWidth(hfw);
        widget->setSizePolicy(sizepolicy);
        qlayout->addItem(widget);
    }
    // make sure only one iteration is done.
    // run with tst_QGraphicsLinearLayout.exe "heightForWidth" -tickcounter -iterations 6
    // this will iterate 6 times the whole test, (not only the benchmark)
    // which should reduce warmup time and give a realistic picture of the performance of
    // effectiveSizeHint()
    QSizeF constraint(hfw ? 100 : -1, -1);
    QBENCHMARK {
        (void)form->effectiveSizeHint(Qt::PreferredSize, constraint);
    }

}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:45,代码来源:tst_qgraphicslinearlayout.cpp

示例12: QWidget

VideoWidget::VideoWidget(MainWindow *main) : QWidget((QWidget *)main)
{
    m_main = main;
    m_xOffset=0;
    m_yOffset=0;
    m_background = NULL;
    m_scale = 1.0;
    m_drag = false;
    m_selection = false;
    m_pm = new QPixmap;

    // set size policy--- preferred aspect ratio
    QSizePolicy policy = sizePolicy();
    policy.setHeightForWidth(true);
    setSizePolicy(policy);

    setMouseTracking(true);
}
开发者ID:achambers16,项目名称:pixy,代码行数:18,代码来源:videowidget.cpp

示例13: setAttribute

QSFMLCanvas::QSFMLCanvas(QWidget* Parent) :
QWidget       (Parent),
myInitialized (false),
paintCount (0)
{
    // Setup some states to allow direct rendering into the widget
    setAttribute(Qt::WA_PaintOnScreen);
    setAttribute(Qt::WA_OpaquePaintEvent);
    setAttribute(Qt::WA_NoSystemBackground);
    setAttribute(Qt::WA_PaintUnclipped);

    // Set strong focus to enable keyboard events to be received
    setFocusPolicy(Qt::WheelFocus);

    QSizePolicy test = this->sizePolicy();// (QSizePolicy::Minimum, QSizePolicy::Minimum);
    test.setHeightForWidth(true);
    setSizePolicy(test);
}
开发者ID:cpp3ds,项目名称:cpp3ds,代码行数:18,代码来源:SFMLWidget.cpp

示例14: QWidget

VideoWidget::VideoWidget(MainWindow *main) : QWidget((QWidget *)main), m_mutex(QMutex::Recursive)
{
    qRegisterMetaType<VideoWidget::InputMode>("VideoWidget::InputMode");

    m_main = main;
    m_xOffset=0;
    m_yOffset=0;
    m_scale = 1.0;
    m_drag = false;
    m_inputMode = NONE;
    m_selection = false;

    // set size policy--- preferred aspect ratio
    QSizePolicy policy = sizePolicy();
    policy.setHeightForWidth(true);
    setSizePolicy(policy);

    setMouseTracking(true);
}
开发者ID:Neon22,项目名称:pixy,代码行数:19,代码来源:videowidget.cpp

示例15: QgsMapCanvas

ImageCanvas::ImageCanvas(DatabaseHandler * db, QWidget * parent) : QgsMapCanvas(parent),  parent(parent), db(db)  {
//	sizePolicy().setHeightForWidth(true);
	QSizePolicy policy;
	policy.setHorizontalPolicy(QSizePolicy::Expanding);
	policy.setVerticalPolicy(QSizePolicy::Preferred);
	policy.setHeightForWidth(true);
	setSizePolicy(policy);
	setBaseSize(240,240);
	enableAntiAliasing(true);
	setParallelRenderingEnabled( true );
	setCanvasColor(QColor(0, 0, 0));
	freeze(false);
	setCachingEnabled(true);
	setCacheMode(QgsMapCanvas::CacheBackground);
	setMapUnits(QGis::Meters);

	provider_registry = QgsProviderRegistry::instance();
	layer_registry = QgsMapLayerRegistry::instance();

}
开发者ID:ifaoe,项目名称:2015-08-Daisi-Image-Library,代码行数:20,代码来源:ImageCanvas.cpp


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