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


C++ sizePolicy函数代码示例

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


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

示例1: QMainWindow

// ------------------------------------------
//  csImgGoogle MainWindow
// ------------------------------------------
csImgGoogle::csImgGoogle( QWidget *parent)
 : QMainWindow( parent)
{
    // ---------------------------
    // Setup the MainGUI
    // ---------------------------
    setupUi(this);

    // page attributes
    page.settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);

    myWebView = new csWebView(centralwidget);
    myWebView->setObjectName(QString::fromUtf8("myWebView"));
    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(myWebView->sizePolicy().hasHeightForWidth());
    myWebView->setSizePolicy(sizePolicy);
    myWebView->setMinimumSize(QSize(500, 0));
    myWebView->setUrl(QUrl("http://www.google.com/imghp"));
    gridLayout->addWidget(myWebView, 1, 0, 1, 1);

    // ---------------------------
    // create the cglx server
    // ---------------------------
    connected   = false;

    sm	= new myserver(CS_HCI_CUST_SERV,contact_port, CS_SERV_ACTIVE);

    // ---------------------------
    // connect slots and signals
    // ---------------------------
    connect(actionExit, SIGNAL(triggered()), this, SLOT(fileExit()));
    connect(actionConnect, SIGNAL(triggered()), this, SLOT(cs_connect()));
    connect(actionDisconnect, SIGNAL(triggered()), this, SLOT(cs_disconnect()));
    connect(actionLoad_Image, SIGNAL(triggered()), this, SLOT(cs_loadImages()));


    connect(myWebView, SIGNAL(send_image(int,int,const QUrl &)), this, SLOT(sendImgURIToClient(int,int,const QUrl &)));

    sm->setGoogler(this);

    // web inspector
    inspector   = new QWebInspector();
    inspector->setPage(myWebView->page());
}
开发者ID:calit2-kvl,项目名称:vr_connect,代码行数:49,代码来源:main.cpp

示例2: QDoubleSpinBox

QDoubleSpinBox *REIXSXESSpectrometerControlEditor::createDoubleSpinBox(double value, double min, double max, QString suffix, double decimals)
{
	QDoubleSpinBox* spinBox = new QDoubleSpinBox();
	spinBox->setValue(value);
	spinBox->setMinimum(min);
	spinBox->setMaximum(max);
	spinBox->setSuffix(suffix);
	spinBox->setDecimals((int)decimals);

	QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	sizePolicy.setHorizontalStretch(0);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(spinBox->sizePolicy().hasHeightForWidth());
	spinBox->setSizePolicy(sizePolicy);

	return spinBox;
}
开发者ID:acquaman,项目名称:acquaman,代码行数:17,代码来源:REIXSXESSpectrometerControlEditor.cpp

示例3: sizePolicy

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

示例4: sizePolicy

/*!
  \brief Set the wheel's orientation.
  \param o Orientation. Allowed values are
           Qt::Horizontal and Qt::Vertical.
   Defaults to Qt::Horizontal.
  \sa QwtAbstractSlider::orientation()
*/
void QwtWheel::setOrientation( Qt::Orientation o )
{
    if ( orientation() == o )
        return;

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

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    QwtAbstractSlider::setOrientation( o );
    update();
}
开发者ID:TheLortex,项目名称:Robotique-MJC-2011,代码行数:24,代码来源:qwt_wheel.cpp

示例5: ExLineEdit

SearchLineEdit::SearchLineEdit(QWidget *parent)
    : ExLineEdit(parent), searchButton(new SearchButton(this)) {
    connect(m_lineEdit, SIGNAL(textChanged(const QString &)), SIGNAL(textChanged(const QString &)));
    connect(m_lineEdit, SIGNAL(textEdited(const QString &)), SIGNAL(textEdited(const QString &)));
    connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(returnPressed()));

    setLeftWidget(searchButton);
    inactiveText = tr("Search");

    QSizePolicy policy = sizePolicy();
    setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());

    // completion
    autoComplete = new AutoComplete(this, m_lineEdit);
    connect(autoComplete, SIGNAL(suggestionAccepted(Suggestion *)),
            SIGNAL(suggestionAccepted(Suggestion *)));
}
开发者ID:flaviotordini,项目名称:musique,代码行数:17,代码来源:searchlineedit.cpp

示例6: orientation

/*!
  \brief Set the wheel's orientation.

  The default orientation is Qt::Horizontal.

  \param orientation Qt::Horizontal or Qt::Vertical.
  \sa orientation()
*/
void QwtWheel::setOrientation( Qt::Orientation orientation )
{
    if ( d_data->orientation == orientation )
        return;

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

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    d_data->orientation = orientation;
    update();
}
开发者ID:NREL,项目名称:OpenStudio,代码行数:25,代码来源:qwt_wheel.cpp

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

示例8: orientation

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

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

    d_data->orientation = orientation;

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

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    layoutThermo( true );
}
开发者ID:151706061,项目名称:sofa,代码行数:24,代码来源:qwt_thermo.cpp

示例9: QMainWindow

QtCamera::QtCamera(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);

	m_frameCount = 0;
	m_captureThread = NULL;
	m_frameRateTimer = 0;
	m_frameRefreshTimer = 0;
	m_camera = NULL;

	QWidget *centralWidget = new QWidget(this);
	QVBoxLayout *verticalLayout = new QVBoxLayout(centralWidget);
	verticalLayout->setSpacing(6);
	verticalLayout->setContentsMargins(0, 0, 0, 0);
	m_cameraView = new QLabel(centralWidget);
	
	QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	sizePolicy.setHorizontalStretch(0);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(m_cameraView->sizePolicy().hasHeightForWidth());
	m_cameraView->setSizePolicy(sizePolicy);
	m_cameraView->setMinimumSize(QSize(320, 240));
	m_cameraView->setAlignment(Qt::AlignCenter);

	verticalLayout->addWidget(m_cameraView);

	setCentralWidget(centralWidget);


	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionStart, SIGNAL(triggered()), this, SLOT(startVideo()));
	connect(ui.actionStop, SIGNAL(triggered()), this, SLOT(stopVideo()));
	connect(ui.actionScale, SIGNAL(triggered()), this, SLOT(toggleScaling()));

	m_pStatus = new QLabel(this);
	m_pStatus->setAlignment(Qt::AlignCenter | Qt::AlignLeft);
	m_pStatus->setText("0.0 fps  ");
	ui.statusBar->addPermanentWidget(m_pStatus);

	ui.actionStop->setEnabled(false);
	ui.actionStart->setEnabled(true);
	m_scaling = ui.actionScale->isChecked();
}
开发者ID:jhonconal,项目名称:QtCamera,代码行数:44,代码来源:qtcamera.cpp

示例10: QGroupBox

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

    // Create a button group and set to exclusive.
    m_buttonGroup = new QButtonGroup(this);
    m_buttonGroup->addButton(ui->autoRadioButton, CarMode::Auto);
    m_buttonGroup->addButton(ui->assistedRadioButton, CarMode::Assisted);
    m_buttonGroup->addButton(ui->manualRadioButton, CarMode::Manual);
    m_buttonGroup->addButton(ui->notConnectedRadioButton, CarMode::NotConnected);
    m_buttonGroup->setExclusive(true);

    // Add filters.
    ui->filterComboBox->addItem("EKF", (int)FilterType::EKF);
    ui->filterComboBox->addItem("ParticleFilter", (int)FilterType::ParticleFilter);
    ui->filterComboBox->addItem("NoFilter", (int)FilterType::NoFilter);
    // Add motion models.
    ui->motionModelComboBox->addItem("CTModel", (int)MotionModelType::CTModel);
    ui->motionModelComboBox->addItem("STModel", (int)MotionModelType::STModel);

    // Add hand controllers
    ui->handControllercomboBox->addItem("Hand Controller 1", (int)HandController::HandControl_1);
    ui->handControllercomboBox->addItem("Hand Controller 2", (int)HandController::HandControl_2);

    // Add controllers.
    ui->controllerComboBox->addItem("PIDdefault", (int)ControllerType::PIDdefault);
    ui->controllerComboBox->addItem("PIDuser", (int)ControllerType::PIDuser);
    ui->controllerComboBox->addItem("PIDadaptiveGain", (int)ControllerType::PIDadaptiveGain);
    ui->controllerComboBox->addItem("PIDadaptiveSection", (int)ControllerType::PIDadaptiveSection);



    // Set fixed width of combo boxes (not optimal solution, but it works).
    ui->filterComboBox->setFixedWidth(70);
    ui->motionModelComboBox->setFixedWidth(100);
    ui->controllerComboBox->setFixedWidth(130);

    QSizePolicy policy = sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Fixed);
    policy.setVerticalPolicy(QSizePolicy::Fixed);
    setSizePolicy(policy);
}
开发者ID:projectCARS,项目名称:CARS2014-GIT,代码行数:44,代码来源:cargroupbox.cpp

示例11: sizePolicy

void TEasyButtonBar::finalize()
{
    if( mpTAction->mUseCustomLayout )
    {
        return;
    }
    QWidget * fillerWidget = new QWidget;

    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding );
    fillerWidget->setSizePolicy( sizePolicy );
    //fillerWidget->setMinimumHeight(1);
    //fillerWidget->setMinimumWidth(1);
    int columns = mpTAction->getButtonColumns();
    if( columns <= 0 ) columns = 1;
    if( mpLayout )
    {
        mpLayout->addWidget( fillerWidget, ++mItemCount/columns, mItemCount%columns );
    }
}
开发者ID:Kurios,项目名称:mudlet-dev,代码行数:19,代码来源:TEasyButtonBar.cpp

示例12: sizePolicy

void TToolBar::finalize()
{
    if( mpTAction->mUseCustomLayout )
    {
        return;
    }
    QWidget * fillerWidget = new QWidget;
    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding );
    fillerWidget->setSizePolicy( sizePolicy );
    int columns = mpTAction->getButtonColumns();
    if( columns <= 0 )
        columns = 1;
    int row = (++mItemCount) / columns;
    int column = (mItemCount - 1) % columns ;
    mpLayout->addWidget( fillerWidget, row, column);
// 3 lines above are to avoid order of operations problem of orginal line
// (-Wsequence-point warning on mItemCount) NEEDS TO BE CHECKED:
//    mpLayout->addWidget( fillerWidget, ++mItemCount/columns, mItemCount%columns );
}
开发者ID:alex-games,项目名称:a1,代码行数:19,代码来源:TToolBar.cpp

示例13: LineEdit

/*
    SearchLineEdit is an enhanced QLineEdit
    - A Search icon on the left with optional menu
    - When there is no text and doesn't have focus an "inactive text" is displayed
    - When there is text a clear button is displayed on the right hand side
 */
SearchLineEdit::SearchLineEdit(QWidget *parent)
    : LineEdit(parent)
    , m_searchButton(new SearchButton(this))
{
    addWidget(m_searchButton, LeftSide);
    m_inactiveText = tr("Search");

    QSizePolicy policy = sizePolicy();
    setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());

    // clear button on the right
    ClearButton *m_clearButton = new ClearButton(this);
    connect(m_clearButton, SIGNAL(clicked()),
            this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(const QString&)),
            m_clearButton, SLOT(textChanged(const QString&)));
    addWidget(m_clearButton, RightSide);
    m_clearButton->hide();
}
开发者ID:fbt-xx,项目名称:arora,代码行数:25,代码来源:searchlineedit.cpp

示例14: QMainWindow

SyntroPythonMainWindow::SyntroPythonMainWindow(SyntroPythonGlue *glue)
    : QMainWindow(), SyntroPythonMain(glue)
{
    setWindowFlags((Qt::WindowTitleHint | Qt::CustomizeWindowHint) &
                   ~(Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint));

    connect(this, SIGNAL(clientSendAVData(int,QByteArray,QByteArray)),
                         m_client, SLOT(clientSendAVData(int,QByteArray,QByteArray)));

    connect(this, SIGNAL(clientSendJpegAVData(int,QByteArray,QByteArray)),
                         m_client, SLOT(clientSendJpegAVData(int,QByteArray,QByteArray)));

    connect(this, SIGNAL(clientSendMulticastData(int,QByteArray)),
                         m_client, SLOT(clientSendMulticastData(int,QByteArray)));

    connect(this, SIGNAL(clientSendE2EData(int,QByteArray)),
                         m_client, SLOT(clientSendE2EData(int,QByteArray)));

    connect(this, SIGNAL(windowTitleSignal(QString)), this, SLOT(windowTitleSlot(QString)));

    connect(this, SIGNAL(displayImageSignal(QByteArray,int,int,QString)),
            this, SLOT(displayImageSlot(QByteArray,int,int,QString)));

    connect(this, SIGNAL(displayJpegImageSignal(QByteArray,QString)),
            this, SLOT(displayJpegImageSlot(QByteArray,QString)));

    QWidget *centralWidget = new QWidget(this);
    QVBoxLayout *verticalLayout = new QVBoxLayout(centralWidget);
    verticalLayout->setSpacing(6);
    verticalLayout->setContentsMargins(0, 0, 0, 0);
    m_imageView = new QLabel(centralWidget);

    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(m_imageView->sizePolicy().hasHeightForWidth());
    m_imageView->setSizePolicy(sizePolicy);
    m_imageView->setMinimumSize(QSize(320, 240));
    m_imageView->setAlignment(Qt::AlignCenter);

    verticalLayout->addWidget(m_imageView);
    setCentralWidget(centralWidget);
}
开发者ID:robotage,项目名称:SyntroPython,代码行数:43,代码来源:SyntroPythonMainWindow.cpp

示例15: QWidget

choose_single::choose_single(QWidget *parent)
	: QWidget(parent)
{
	setAutoFillBackground(true);
	QPalette palette;
	palette.setColor(QPalette::Background, QColor(192, 253, 123));
	setPalette(palette);

	QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
	horizontalLayout->setSpacing(0);
	horizontalLayout->setContentsMargins(1, 1, 1, 1);
	label = new QLabel(this);
	
	QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	sizePolicy.setHorizontalStretch(0);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
	label->setSizePolicy(sizePolicy);
	label->setMinimumSize(QSize(20, 20));
	label->setMaximumSize(QSize(20, 20));

	horizontalLayout->addWidget(label);

	line = new QFrame(this);
	line->setObjectName(QStringLiteral("line"));
	line->setFrameShape(QFrame::VLine);
	line->setFrameShadow(QFrame::Sunken);

	horizontalLayout->addWidget(line);

	lineEdit = new QLabel(this);

	QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed);
	sizePolicy1.setHorizontalStretch(0);
	sizePolicy1.setVerticalStretch(0);
	sizePolicy1.setHeightForWidth(lineEdit->sizePolicy().hasHeightForWidth());
	lineEdit->setSizePolicy(sizePolicy1);
	lineEdit->setMinimumSize(QSize(20, 20));
	lineEdit->setMaximumSize(QSize(20, 20));

	horizontalLayout->addWidget(lineEdit);
	setFixedSize(80, 30);
}
开发者ID:billhhh,项目名称:whLego-version,代码行数:43,代码来源:choose_single.cpp


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