コード例 #1
0
ファイル: main.cpp プロジェクト: calit2-kvl/vr_connect
// ------------------------------------------
//  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());
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: dnotificationwidget.cpp プロジェクト: KDE/digikam
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);
    }
}
コード例 #4
0
/*!
  \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();
}
コード例 #5
0
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 *)));
}
コード例 #6
0
ファイル: qwt_wheel.cpp プロジェクト: NREL/OpenStudio
/*!
  \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();
}
コード例 #7
0
ファイル: videowidget.cpp プロジェクト: achambers16/pixy
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);
}
コード例 #8
0
ファイル: qwt_thermo.cpp プロジェクト: 151706061/sofa
/*!
  \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 );
}
コード例 #9
0
ファイル: qtcamera.cpp プロジェクト: jhonconal/QtCamera
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();
}
コード例 #10
0
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);
}
コード例 #11
0
ファイル: TEasyButtonBar.cpp プロジェクト: Kurios/mudlet-dev
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 );
    }
}
コード例 #12
0
ファイル: TToolBar.cpp プロジェクト: alex-games/a1
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 );
}
コード例 #13
0
ファイル: searchlineedit.cpp プロジェクト: fbt-xx/arora
/*
    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();
}
コード例 #14
0
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);
}
コード例 #15
0
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);
}
コード例 #16
0
ファイル: videowidget.cpp プロジェクト: Neon22/pixy
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);
}
コード例 #17
0
void MyIoVector2D::setValue(const QString str)
{
	QLineEdit *thisButton = qobject_cast<QLineEdit *>(QObject::sender());

	Q_ASSERT(thisButton);
	Q_CHECK_PTR(thisButton);

	int i = thisButton->property("id").toInt();
	if (i < data_master->size()) // change data
	{
		data_master->at(i) = str;
	}

	else if (i == data_master->size()) // add new data
	{
		data_master->push_back(str);


		// layout
		QHBoxLayout *local_layout = new QHBoxLayout;
		local_layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
		entry_layout->addLayout(local_layout, (i + 1) / numberCols, (i + 1) % numberCols);

		//add LineEdit
		QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
		QLineEdit *line = new QLineEdit(this);
		line->setSizePolicy(sizePolicy);
		line->setProperty("id", i + 1);
		line->setMinimumHeight(60);
		local_layout->addWidget(line, 2);

		// add Vector
		std::vector<QString> neu = { "" };
		data_slave->push_back(neu);
		MyIoVector *vect = new MyIoVector(this, &data_slave->at(i));
		qobject_cast<QHBoxLayout *>(localLayout.at(i))->addWidget(vect, 8);


		localLayout.push_back(local_layout);
		connect(line, &QLineEdit::textChanged, this, &MyIoVector2D::setValue);
	}
}
コード例 #18
0
	void MapEditorWindow::setupSceneControllerWidget(QWidget *centralWidget, QHBoxLayout *horizontalLayout)
	{
		sceneControllerWidget = new SceneControllerWidget(centralWidget);
		QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
		sizePolicy.setHorizontalStretch(0);
		sizePolicy.setVerticalStretch(0);
		sizePolicy.setHeightForWidth(sceneControllerWidget->sizePolicy().hasHeightForWidth());
		sceneControllerWidget->setSizePolicy(sizePolicy);
		sceneControllerWidget->setMaximumSize(QSize(380, 16777215));

		sceneControllerWidget->getObjectControllerWidget()->getObjectTableView()->addObserver(this, ObjectTableView::SELECTION_CHANGED);
		sceneControllerWidget->getObjectControllerWidget()->addObserver(this, ObjectControllerWidget::BODY_SHAPE_INITIALIZED);
		sceneControllerWidget->getLightControllerWidget()->getLightTableView()->addObserver(this, LightTableView::SELECTION_CHANGED);
		sceneControllerWidget->getSoundControllerWidget()->getSoundTableView()->addObserver(this, SoundTableView::SELECTION_CHANGED);
		sceneControllerWidget->addObserver(this, SceneControllerWidget::TAB_SELECTED);

		horizontalLayout->addWidget(sceneControllerWidget);

		sceneDisplayerWidget->addObserver(sceneControllerWidget->getObjectControllerWidget(), SceneDisplayerWidget::BODY_PICKED);
	}
コード例 #19
0
ファイル: CQBrowserPane.cpp プロジェクト: bmoreau/COPASI
CQBrowserPane::CQBrowserPane(QWidget* parent) :
  QTreeView(parent)
{
  QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
  sizePolicy.setHorizontalStretch(0);
  sizePolicy.setVerticalStretch(0);
  sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
  setSizePolicy(sizePolicy);
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
  setAutoScroll(true);
  setEditTriggers(QAbstractItemView::NoEditTriggers);
  setTextElideMode(Qt::ElideNone);
  setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
  setUniformRowHeights(true);
  setSortingEnabled(true);
  setHeaderHidden(true);

  connect(this, SIGNAL(expanded(const QModelIndex &)), this, SLOT(slotUpdateScrollBar(const QModelIndex &)));
  connect(this, SIGNAL(collapsed(const QModelIndex &)), this, SLOT(slotUpdateScrollBar(const QModelIndex &)));
}
コード例 #20
0
ファイル: CardLabel.cpp プロジェクト: morefreeze/VenciCode
CardLabel::CardLabel( Card* pc, int offset, QRect rect)
{
    QString resourcePath;
    if(pc->GetColor() == BLACK)
    {
        resourcePath = QString::fromUtf8(":/VenciCode/Resources/Cards/black_bg.png");
    }
    else if(pc->GetColor() == WHITE)
    {
        resourcePath = QString::fromUtf8(":/VenciCode/Resources/Cards/white_bg.png");
    }
    QPixmap *cardImage = new QPixmap(resourcePath);
    DrawNumber(cardImage, pc->GetNumStr());
    setPixmap(*cardImage);
    setGeometry(rect);
    QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    setSizePolicy(sizePolicy);
    pCard = pc;
    this->installEventFilter(this);
}
コード例 #21
0
ファイル: CallPanelMain.cpp プロジェクト: 13W/icq-desktop
Ui::SliderEx::SliderEx(QWidget* parent)
: QWidget(parent) {
    if (this->objectName().isEmpty())
        this->setObjectName(QStringLiteral("sliderEx"));
    this->resize(252, 45);
    horizontal_layout_ = new QHBoxLayout(this);
    horizontal_layout_->setSpacing(0);
    horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
    horizontal_layout_->setContentsMargins(0, 0, 0, 0);
    slider_icon_ = new QPushButton(this);
    slider_icon_->setObjectName(QStringLiteral("sliderIcon"));
    QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(slider_icon_->sizePolicy().hasHeightForWidth());
    slider_icon_->setSizePolicy(sizePolicy);
    
    horizontal_layout_->addWidget(slider_icon_);
    
    slider_ = new QSlider(this);
    slider_->setObjectName(QStringLiteral("slider"));
    QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizePolicy1.setHorizontalStretch(0);
    sizePolicy1.setVerticalStretch(0);
    sizePolicy1.setHeightForWidth(slider_->sizePolicy().hasHeightForWidth());
    slider_->setSizePolicy(sizePolicy1);
    slider_->setOrientation(Qt::Horizontal);
    
    horizontal_layout_->addWidget(slider_);
    
    slider_icon_->setText(QString());
    
    QMetaObject::connectSlotsByName(this);

    slider_->setMaximum(100);
    slider_->setMinimum(0);

    connect(slider_, SIGNAL(valueChanged(int)), this, SLOT(onVolumeChanged(int)), Qt::QueuedConnection);
    connect(slider_, SIGNAL(sliderReleased()), this, SLOT(onVolumeReleased()), Qt::QueuedConnection);
    connect(slider_icon_, SIGNAL(clicked()), this, SLOT(onIconClicked()), Qt::QueuedConnection);
}
コード例 #22
0
/*
This function sets up widgets to enter the parameters for the operation function call.
@param inputCurrentText: The text associated with the function to set up for
*/
void IFSOperationViewer::setupParameterWidgets(const QString & inputCurrentText)
{
std::string functionName(inputCurrentText.toAscii().constData());


functionDetails detailsBuffer(functionDetailsMap[functionName]);

//Clear the existing widgets
for(int i=0; i<parameterLabels.size(); i++)
{
delete parameterLabels[i];
}
parameterLabels.clear();

for(int i=0; i<parameterLineEdits.size(); i++)
{
delete parameterLineEdits[i];
}
parameterLineEdits.clear();

//Populate the widgets
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
for(int i=0; i<detailsBuffer.arguments.size(); i++)
{
parameterLabels.push_back(new QLabel(parameterGroupBox));
parameterLabels.back()->setText(detailsBuffer.arguments[i].c_str());
parameterLabels.back()->setSizePolicy(sizePolicy);
parametersLayout->addWidget(parameterLabels.back(), i, 0, 1, 1);

parameterLineEdits.push_back(new QLineEdit(parameterGroupBox));
//Set to only allow floating point numbers
parameterLineEdits.back()->setValidator( new QDoubleValidator(-FLT_MAX, FLT_MAX, 6,this) );
//Set the default value to 0.0
parameterLineEdits.back()->setText(QString("0.0"));
//Set it not to expand
parameterLineEdits.back()->setSizePolicy(sizePolicy);
//Put it in the layout
parametersLayout->addWidget(parameterLineEdits.back(), i, 1, 1, 1);

}
}
コード例 #23
0
ファイル: hgsceneitem.cpp プロジェクト: huqiuyun/qt.project
void HGSceneItem::reSize(const QRectF& rect)
{
    Q_D(HGSceneItem);
    if (!d->mView)
        return ;

    if (sizePolicy() == QSizePolicy::Fixed) {
        d->mView->setSceneRect(rect);
    }

    //other items adjust rect
    QSize s(rect.width(),rect.height());
    for (int i = 0; i < d->mChilds.count(); i++) {

        const HItemWidget<HGWidget>* iter = &d->mChilds.at(i);

        QRectF rc(QPoint(0,0),s);

        if (iter->margins.left()<0)
            rc.setLeft( s.width() + iter->margins.left());
        if (iter->margins.left()>0)
            rc.setLeft(iter->margins.left());

        if (iter->margins.right()<0)
            rc.setRight(s.width() + iter->margins.right());
        else if(iter->margins.right()>0)
            rc.setRight(iter->margins.right());

        if (iter->margins.top()<0)
            rc.setTop( s.height() + iter->margins.top());
        else if (iter->margins.top()>0)
            rc.setTop(iter->margins.top());

        if (iter->margins.bottom()<0)
            rc.setBottom(s.height() + iter->margins.bottom());
        else if(iter->margins.bottom()>0)
            rc.setBottom(iter->margins.bottom());

        iter->widget->setGeometry(rc);
    }
}
コード例 #24
0
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);
}
コード例 #25
0
ファイル: qsplitter.cpp プロジェクト: Fale/qtmoko
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());
}
コード例 #26
0
ファイル: cpuload.cpp プロジェクト: rhn/graphmon
CPULoad::CPULoad(void)
{
    m_signal_plotter = new SimplePlotter();
    this->m_signal_plotter->setBackgroundColor(Qt::black);
    this->m_signal_plotter->setUseAutoMax(false);
    this->m_signal_plotter->setVerticalRange(0, 100);

    this->m_signal_plotter->addPlot(Qt::red);
    this->m_signal_plotter->addPlot(Qt::green);
    this->m_signal_plotter->addPlot(Qt::yellow);
    this->m_signal_plotter->addPlot(Qt::white);

    this->m_signal_plotter->setPreferredSize(100, 100);
    this->m_signal_plotter->setMinimumSize(10, 10);


    QSizePolicy sizePolicy(
        QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    this->m_signal_plotter->setSizePolicy(sizePolicy);
    // TODO: memory leak
}
コード例 #27
0
ファイル: qwt_thermo.cpp プロジェクト: 01iv3r/OpenPilot
/*!
   \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 );
}
コード例 #28
0
ファイル: searchpinyin.cpp プロジェクト: ohwgiles/browzi
SearchPinyin::SearchPinyin()
{
	QVBoxLayout* vtLayout = new QVBoxLayout(this);

	QLabel* pinyinLabel = new QLabel(this);
	pinyinLabel->setText("Pinyin:");
	vtLayout->addWidget(pinyinLabel);

	pinyin = new QLineEdit(this);
	vtLayout->addWidget(pinyin);

	QLabel* disambiguateLabel = new QLabel(this);
	disambiguateLabel->setText("Disambiguate:");
	disambiguateLabel->setObjectName(QString::fromUtf8("label"));
	vtLayout->addWidget(disambiguateLabel);

	QScrollArea* candidatesScrollArea = new QScrollArea(this);
	QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	sizePolicy.setHorizontalStretch(0);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(candidatesScrollArea->sizePolicy().hasHeightForWidth());
	candidatesScrollArea->setSizePolicy(sizePolicy);
	candidatesScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	candidatesScrollArea->setWidgetResizable(true);

	candidates = new RowedList(font(), false, candidatesScrollArea);
	candidatesScrollArea->setWidget(candidates);
	candidatesScrollArea->setWidgetResizable(true);

	vtLayout->addWidget(candidatesScrollArea);

	stmt = createStatement(
		"select utf8 from utf8Table join \
		kMandarinTable on kMandarinTable.code = utf8Table.code \
		where kMandarinTable.kMandarin = ?;");

	connect(pinyin, SIGNAL(textEdited(QString)), this, SLOT(searchTermChanged(QString)));
	connect(candidates, SIGNAL(characterSelected(QString)), this, SLOT(disambiguated(QString)));

}
int QGraphicsAnchor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< qreal*>(_v) = spacing(); break;
        case 1: *reinterpret_cast< QSizePolicy::Policy*>(_v) = sizePolicy(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSpacing(*reinterpret_cast< qreal*>(_v)); break;
        case 1: setSizePolicy(*reinterpret_cast< QSizePolicy::Policy*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 0: unsetSpacing(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #30
0
ファイル: qwt_slider.cpp プロジェクト: 151706061/sofa
/*!
  \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 );
}