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


C++ QSizePolicy类代码示例

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


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

示例1: QWidget

OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QSplitter* parent)
   : QWidget(parent), d(new OutputPanePlaceHolderPrivate(mode, parent))
{
    setVisible(false);
    setLayout(new QVBoxLayout);
    QSizePolicy sp;
    sp.setHorizontalPolicy(QSizePolicy::Preferred);
    sp.setVerticalPolicy(QSizePolicy::Preferred);
    sp.setHorizontalStretch(0);
    setSizePolicy(sp);
    layout()->setMargin(0);
    connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
            this, SLOT(currentModeChanged(Core::IMode*)));

//    d->m_current = this;
//    Internal::OutputPaneManager *om = Internal::OutputPaneManager::instance();
//    layout()->addWidget(om);
//    om->show();
//    om->updateStatusButtons(isVisible());
}
开发者ID:Daylie,项目名称:Totem,代码行数:20,代码来源:outputpaneplaceholder.cpp

示例2: Q_D

void OpenconnectAuthWidget::viewServerLogToggled(bool toggled)
{
    Q_D(OpenconnectAuthWidget);
    d->ui.lblLogLevel->setVisible(toggled);
    d->ui.cmbLogLevel->setVisible(toggled);
    if (toggled) {
        delete d->ui.verticalLayout->takeAt(5);
        QSizePolicy policy = d->ui.serverLogBox->sizePolicy();
        policy.setVerticalPolicy(QSizePolicy::Expanding);
        d->ui.serverLogBox->setSizePolicy(policy);
        d->ui.serverLog->setVisible(true);
    } else {
        QSpacerItem *verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        d->ui.verticalLayout->addItem(verticalSpacer);
        d->ui.serverLog->setVisible(false);
        QSizePolicy policy = d->ui.serverLogBox->sizePolicy();
        policy.setVerticalPolicy(QSizePolicy::Fixed);
        d->ui.serverLogBox->setSizePolicy(policy);
    }
}
开发者ID:KDE,项目名称:plasma-nm,代码行数:20,代码来源:openconnectauth.cpp

示例3: 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

示例4: QWidget

VideoWidget::VideoWidget(MainWindow *main) : QWidget((QWidget *)main)
{
    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;
    m_aspectRatio = VW_ASPECT_RATIO;

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

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

示例5: setSizePolicy

void AnimatedFrame::updateSizeHints()
{
	if(widget_) {
		QSize hint = widget_->minimumSizeHint();
		if(!hint.isValid())
			hint = widget_->sizeHint();

		QSizePolicy policy = widget_->sizePolicy();

		if(edge_ == kNorth || edge_ == kSouth) {
			int minimum = widget_->minimumHeight();
			int maximum = widget_->maximumHeight();

			minimumSizeHint_.setWidth(0);
			minimumSizeHint_.setHeight(qBound(minimum, hint.height(), maximum));

			setSizePolicy(policy.horizontalPolicy(), QSizePolicy::Maximum);
		}
		else {
			int minimum = widget_->minimumWidth();
			int maximum = widget_->maximumWidth();

			minimumSizeHint_.setWidth(qBound(minimum, hint.width(), maximum));
			minimumSizeHint_.setHeight(0);

			setSizePolicy(QSizePolicy::Maximum, policy.verticalPolicy());
		}

		setMinimumSize(widget_->minimumSize());
		setMaximumSize(widget_->maximumSize());
	}
	else {
		minimumSizeHint_ = QSize();
		setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	}

	sizeHint_ = minimumSizeHint_;

	if(isUnfolded())
		updateGeometry();
}
开发者ID:phantom-code,项目名称:mindcache,代码行数:41,代码来源:animatedframe.cpp

示例6: makeEditorWidgets

void BaseOrdinalMinMaxTextPropertyWidgetQt::generateWidget() {
    makeEditorWidgets();
    
    QHBoxLayout* hLayout = new QHBoxLayout();
    setSpacingAndMargins(hLayout);
    label_ = new EditableLabelQt(this, property_);
    hLayout->addWidget(label_);
    
    QHBoxLayout* textLayout = new QHBoxLayout();
    QWidget* textWidget = new QWidget();
    textWidget->setLayout(textLayout);
    textLayout->setContentsMargins(0,0,0,0);
    
    QSizePolicy sp = QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    sp.setHorizontalStretch(3);

    QLabel* minLabel = new QLabel("Min:");
    textLayout->addWidget(minLabel);
    textLayout->addWidget(min_);
    min_->setSizePolicy(sp);

    QLabel* maxLabel = new QLabel("Max:");
    textLayout->addWidget(maxLabel);
    textLayout->addWidget(max_);
    max_->setSizePolicy(sp);
    
    hLayout->addWidget(textWidget);
    setLayout(hLayout);
    
    QSizePolicy textsp = textWidget->sizePolicy();
    textsp.setHorizontalStretch(3);
    textWidget->setSizePolicy(textsp);
    
    connect(min_, SIGNAL(valueChanged()), this, SLOT(updateFromMin()));
    connect(max_, SIGNAL(valueChanged()), this, SLOT(updateFromMax()));
    
    setFixedHeight(sizeHint().height());
    sp = sizePolicy();
    sp.setVerticalPolicy(QSizePolicy::Fixed);
    setSizePolicy(sp);
}
开发者ID:sarbi127,项目名称:inviwo,代码行数:41,代码来源:ordinalminmaxtextpropertywidgetqt.cpp

示例7: Q_D

void QSplitter::setOrientation(Qt::Orientation orientation)
{
    Q_D(QSplitter);
    if (d->orient == orientation)
        return;

    if (!testAttribute(Qt::WA_WState_OwnSizePolicy)) {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy(sp);
        setAttribute(Qt::WA_WState_OwnSizePolicy, false);
    }

    d->orient = orientation;

    for (int i = 0; i < d->list.size(); ++i) {
        QSplitterLayoutStruct *s = d->list.at(i);
        s->handle->setOrientation(orientation);
    }
    d->recalc(isVisible());
}
开发者ID:Fale,项目名称:qtmoko,代码行数:21,代码来源:qsplitter.cpp

示例8: QScrollArea

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

示例9: setScalePosition

/*!
   \brief Set the thermometer orientation and the scale position.

   The scale position NoScale disables the scale.
   \param o orientation. Possible values are Qt::Horizontal and Qt::Vertical.
         The default value is Qt::Vertical.
   \param s Position of the scale.
         The default value is NoScale.

   A valid combination of scale position and orientation is enforced:
   - a horizontal thermometer can have the scale positions TopScale,
     BottomScale or NoScale;
   - a vertical thermometer can have the scale positions LeftScale,
     RightScale or NoScale;
   - an invalid scale position will default to NoScale.

   \sa setScalePosition()
*/
void QwtThermo::setOrientation( Qt::Orientation o, ScalePos s )
{
    if ( o == d_data->orientation && s == d_data->scalePos )
        return;

    switch ( o )
    {
        case Qt::Horizontal:
        {
            if ( ( s == NoScale ) || ( s == BottomScale ) || ( s == TopScale ) )
                d_data->scalePos = s;
            else
                d_data->scalePos = NoScale;
            break;
        }
        case Qt::Vertical:
        {
            if ( ( s == NoScale ) || ( s == LeftScale ) || ( s == RightScale ) )
                d_data->scalePos = s;
            else
                d_data->scalePos = NoScale;
            break;
        }
    }

    if ( o != d_data->orientation )
    {
        if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
        {
            QSizePolicy sp = sizePolicy();
            sp.transpose();
            setSizePolicy( sp );

            setAttribute( Qt::WA_WState_OwnSizePolicy, false );
        }
    }

    d_data->orientation = o;
    layoutThermo( true );
}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:58,代码来源:qwt_thermo.cpp

示例10: orientation

/*!
  \brief Set the orientation.
  \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.

  \sa orientation(), scalePosition()
*/
void QwtSlider::setOrientation( Qt::Orientation orientation )
{
    if ( orientation == d_data->orientation )
        return;

    d_data->orientation = orientation;

    scaleDraw()->setAlignment( 
        qwtScaleDrawAlignment( orientation, d_data->scalePosition ) );

    if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy( sp );

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    if ( testAttribute( Qt::WA_WState_Polished ) )
        layoutSlider( true );
}
开发者ID:151706061,项目名称:sofa,代码行数:28,代码来源:qwt_slider.cpp

示例11: QHBoxLayout

void OptionPropertyWidgetQt::generateWidget() {
    QHBoxLayout* hLayout = new QHBoxLayout();
    hLayout->setContentsMargins(0, 0, 0, 0);
    hLayout->setSpacing(7);
    setLayout(hLayout);

    comboBox_ = new IvwComboBox(this);
    updateFromProperty();

    comboBox_->setEnabled(!property_->getReadOnly());
    comboBox_->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(comboBox_,
            SIGNAL(customContextMenuRequested(const QPoint&)),
            this,
            SLOT(showContextMenu(const QPoint&)));
    
    QSizePolicy slidersPol = comboBox_->sizePolicy();
    slidersPol.setHorizontalStretch(3);
    comboBox_->setSizePolicy(slidersPol);
    
    label_ = new EditableLabelQt(this, property_);
    hLayout->addWidget(label_);
    
    {
        QWidget* widget = new QWidget(this);
        QSizePolicy sliderPol = widget->sizePolicy();
        sliderPol.setHorizontalStretch(3);
        widget->setSizePolicy(sliderPol);
        QGridLayout* vLayout = new QGridLayout();
        widget->setLayout(vLayout);
        vLayout->setContentsMargins(0, 0, 0, 0);
        vLayout->setSpacing(0);
        
        vLayout->addWidget(comboBox_);
        hLayout->addWidget(widget);
    }
    
    connect(comboBox_, SIGNAL(currentIndexChanged(int)),this, SLOT(optionChanged()));
}
开发者ID:cgloger,项目名称:inviwo,代码行数:39,代码来源:optionpropertywidgetqt.cpp

示例12: QWidget

QOptionsDialogTab::QOptionsDialogTab(QWidget *parent) : QWidget(parent) {
	int space = 10;
	switch (ZLDeviceInfo::screenSize()) {
		case ZLDeviceInfo::SIZE_640x480:
			space = 10;
			break;
		default:
			space = 3;
			break;
	}
	myLayout = new QGridLayout(this, -1, 12, space, space);
	myRowCounter = 0;

#if 0
	QSizePolicy pol = this->sizePolicy();
	pol.setHorData(QSizePolicy::Fixed);
	this->setSizePolicy(pol);
	QRect rect = QRect(0, 0, 240, 320);
	myLayout->setGeometry(rect);
	myLayout->setColStretch(12, 12);
#endif
}
开发者ID:xufooo,项目名称:fbreader-e2-test,代码行数:22,代码来源:QOptionsDialog.cpp

示例13: m_id

WListItem::WListItem(const QString &city, const QString &state, const QString &id, QListWidget *citiesList)
    : m_id(id), m_name(city), m_state(state)
{
	QString title = QString::fromLatin1("%1<br>%2")
	        .arg(Qt::escape(city), Qt::escape(state));
	m_label = new QLabel(title, this);
	QSizePolicy policy = m_label->sizePolicy();
	policy.setHorizontalPolicy(QSizePolicy::MinimumExpanding);
	m_label->setSizePolicy(policy);
	m_button = new QPushButton(tr("Remove"), this);
	m_button->setIcon(qutim_sdk_0_3::Icon(QLatin1String("list-remove")));
	connect(m_button, SIGNAL(clicked(bool)), this, SIGNAL(buttonClicked()));
	
	QHBoxLayout *layout = new QHBoxLayout(this);
	layout->addWidget(m_label);
	layout->addWidget(m_button);

	m_item = new QListWidgetItem(citiesList);
	m_item->setData(Qt::UserRole, qVariantFromValue(Guard(this)));
	m_item->setData(Qt::SizeHintRole, sizeHint());
	citiesList->setItemWidget(m_item, this);
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:22,代码来源:wlistitem.cpp

示例14: QVBoxLayout

void Data_analysis_gui::init_controls_area() {
  QVBoxLayout * vbox = new QVBoxLayout();
  controls_box_->setLayout(vbox);
  /*
  controls_box_->setOrientation( Qt::Vertical );
  controls_box_->setColumns( 1 );
  */
  QRect controls_tabwidget_geom = controls_tabwidget_->geometry();
  controls_tabwidget_geom.setWidth( 220 );
  controls_tabwidget_->setGeometry( controls_tabwidget_geom );

  QSizePolicy policy;
  policy.setHorizontalStretch(1);
  policy.setVerticalStretch(1);
  controls_tabwidget_->setSizePolicy(policy);

  //splitter_->setResizeMode( controls_tabwidget_, QSplitter::KeepSize );

  // signal-slot connections for the axis preferences
  QObject::connect( minx_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_x_axis_min() ) );
  QObject::connect( maxx_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_x_axis_max() ) );
  QObject::connect( miny_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_y_axis_min() ) );
  QObject::connect( maxy_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_y_axis_max() ) );

  QObject::connect( reset_axis_x_button_, SIGNAL( clicked() ),
                    this, SLOT( reset_x_axis() ) );
  QObject::connect( reset_axis_y_button_, SIGNAL( clicked() ),
                    this, SLOT( reset_y_axis() ) );

  QObject::connect( x_logscale_checkbox_, SIGNAL( toggled( bool ) ),
                    this, SLOT( set_x_axis_logscale( bool ) ) );
  QObject::connect( y_logscale_checkbox_, SIGNAL( toggled( bool ) ),
                    this, SLOT( set_y_axis_logscale( bool ) ) );

}
开发者ID:DMachuca,项目名称:ar2tech-SGeMS-public,代码行数:39,代码来源:data_analysis_gui.cpp

示例15: m_outlineCombo

LuaEditorWidget::LuaEditorWidget()
	: m_outlineCombo(new QComboBox)
{
	m_updateDocumentTimer.setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
	m_updateDocumentTimer.setSingleShot(true);
	connect(&m_updateDocumentTimer, QTimer::timeout, this, LuaEditorWidget::updateDocument);
	connect(this, QPlainTextEdit::textChanged, [this](){m_updateDocumentTimer.start();});
	
	m_outlineCombo->setMinimumContentsLength(22);
	
	QTreeView* treeView = new QTreeView;
	treeView->header()->hide();
	treeView->setItemsExpandable(false);
	treeView->setRootIsDecorated(false);
		m_outlineCombo->setView(treeView);
	treeView->expandAll();
	
	QSizePolicy policy = m_outlineCombo->sizePolicy();
	policy.setHorizontalPolicy(QSizePolicy::Expanding);
	m_outlineCombo->setSizePolicy(policy);
	
	insertExtraToolBarWidget(TextEditorWidget::Left, m_outlineCombo);
}
开发者ID:EssGeeEich,项目名称:LuaEditor,代码行数:23,代码来源:luaeditorwidget.cpp


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