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


C++ QScrollArea::setBackgroundRole方法代码示例

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


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

示例1: initUI

void QSysMessagePanel::initUI()
{
    QWidget     *headw = new QWidget(this);
    IconButton  *closeB = QAppUtils::ref().getCloseIconBtn(headw);
    QHBoxLayout *headLay = new QHBoxLayout(headw);
    QWidget     *center = new QWidget(this);
    QWidget     *msgWid = new QWidget(center);
    QScrollArea *scroll = new QScrollArea(this);
    QVBoxLayout *vlay = new QVBoxLayout(this);
    QVBoxLayout *vlayMsg = new QVBoxLayout(center);
    int         width,height;


    vlay->setContentsMargins(0,0,0,0);
    vlayMsg->addWidget(msgWid);
    vlayMsg->addStretch();

    QAppUtils::ref().getScreenSize(width,height);
    center->setMinimumSize(width/4.1,height/1.3);
    scroll->setBackgroundRole(QPalette::Dark);
    scroll->setWidget(center);
    scroll->setMinimumSize(width/4,height/1.2);

    headLay->addStretch();
    headLay->addWidget(closeB);
    connect(closeB,SIGNAL(clicked()),this,SLOT(close()));
    m_lay = new QGridLayout(msgWid);
    m_lay->setContentsMargins(0,0,0,0);
    vlay->addWidget(headw);
    vlay->addWidget(scroll);
    vlay->addStretch();
}
开发者ID:hermixy,项目名称:QtDeskTop,代码行数:32,代码来源:qsysmessagepanel.cpp

示例2: QFrame

EventVideoDownloadsWindow::EventVideoDownloadsWindow(QWidget *parent) :
    QFrame(parent)
{
    setAttribute(Qt::WA_DeleteOnClose, true);
    setMinimumSize(550, 300);
	setWindowTitle(tr("Bluecherry - Download Manager"));

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setSpacing(2);
    layout->setMargin(2);

    QScrollArea *downloadArea = new QScrollArea(this);
    downloadArea->setBackgroundRole(QPalette::Base );
    downloadArea->move(0, 0);
    layout->addWidget(downloadArea);

    QFrame *downloadFrame = new QFrame;
    downloadFrame->setBackgroundRole(QPalette::Base);
    downloadFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);

    m_downloadLayout = new QVBoxLayout(downloadFrame);
    m_downloadLayout->setDirection(QBoxLayout::Up);

    downloadArea->setWidget(downloadFrame);
    downloadArea->setWidgetResizable(true);

    QSettings settings;
    restoreGeometry(settings.value(QLatin1String("ui/downloadsWindow/geometry")).toByteArray());

    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveSettings()));
}
开发者ID:Wellsen,项目名称:bluecherry-client,代码行数:31,代码来源:EventVideoDownloadsWindow.cpp

示例3: QDialog

Save::Save(QWidget *parent) : QDialog(parent)
{
	img = 0;
	setModal(false);
	setWindowFlags(Qt::Window);

	QHBoxLayout *layout = new QHBoxLayout(this);

	QVBoxLayout *sLayout = new QVBoxLayout;
	layout->addLayout(sLayout);

	QGroupBox *gbBlock = new QGroupBox(tr("Block size"));
	sLayout->addWidget(gbBlock);
	QHBoxLayout *gbBlockLayout = new QHBoxLayout(gbBlock);
	gbBlockLayout->addWidget(spBlockSize[0] = new QSpinBox);
	gbBlockLayout->addWidget(new QLabel(tr("x")));
	gbBlockLayout->addWidget(spBlockSize[1] = new QSpinBox);
	for (int i = 0; i != 2; i++) {
		spBlockSize[i]->setMinimum(1);
		spBlockSize[i]->setMaximum(2048);
		spBlockSize[i]->setValue(DEFSZ);
	}

	QGroupBox *gbCount = new QGroupBox(tr("Block count"));
	sLayout->addWidget(gbCount);
	QHBoxLayout *gbCountLayout = new QHBoxLayout(gbCount);
	gbCountLayout->addWidget(spBlockCount[0] = new QSpinBox);
	gbCountLayout->addWidget(new QLabel(tr("x")));
	gbCountLayout->addWidget(spBlockCount[1] = new QSpinBox);
	for (int i = 0; i != 2; i++) {
		spBlockCount[i]->setMinimum(1);
		spBlockCount[i]->setMaximum(1000);
		spBlockCount[i]->setValue(DEFCNT);
	}

	sLayout->addWidget(lFinalRes = new QLabel);

	QPushButton *pbRender = new QPushButton(tr("Render"));
	sLayout->addWidget(pbRender);

	QPushButton *pbSave = new QPushButton(tr("Save image"));
	sLayout->addWidget(pbSave);

	layout->addWidget(lwProgess = new QListWidget);

	QScrollArea *saOutput = new QScrollArea;
	saOutput->setBackgroundRole(QPalette::Dark);
	saOutput->setWidget(lOutput = new QLabel);
	layout->addWidget(saOutput, 4);

	for (int i = 0; i != 2; i++) {
		connect(spBlockSize[i], SIGNAL(valueChanged(int)), this, SLOT(updateRes()));
		connect(spBlockCount[i], SIGNAL(valueChanged(int)), this, SLOT(updateRes()));
	}
	connect(pbRender, SIGNAL(clicked(bool)), this, SLOT(render()));
	connect(pbSave, SIGNAL(clicked(bool)), this, SLOT(save()));
	updateRes();
}
开发者ID:zhiyb,项目名称:MathPic,代码行数:58,代码来源:save.cpp

示例4: on_pbPrepare_clicked

void DenoisingWidget::on_pbPrepare_clicked()
{
    // prepare widget
    cleanWidget();

    QLayout *layout;
    if (Constants::showThresholdsWidgetSeparately) {
        QScrollArea* scrollArea = new QScrollArea();
        scrollArea->setBackgroundRole(QPalette::Window);
        scrollArea->setFrameShadow(QFrame::Plain);
        scrollArea->setFrameShape(QFrame::NoFrame);
        scrollArea->setWidgetResizable(true);

        QWidget* wdg = new QWidget();
        wdg->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
        wdg->setLayout(new QVBoxLayout(wdg));
        scrollArea->setWidget(wdg);
        scrollArea->show();

        layout = wdg->layout();
    } else {
        if (!ui->scrollAreaWidgetContents->layout()) {
            ui->scrollAreaWidgetContents->setLayout(new QVBoxLayout());
        }

        layout = ui->scrollAreaWidgetContents->layout();
    }

    // prepare signal (wavelet transform)
    m_denoisingManager->setSignal(*m_noisedAudioSignal.data());
    m_denoisingManager->prepareToDenoising(ui->cbWaveletType->currentText(), ui->sbLevel->value());
    PlotManager::plot(ui->inputTransformedSignalWidget, m_denoisingManager->transformedSignal());

    auto decomposition = m_denoisingManager->transformedDecomposition();
    m_itemsCount = decomposition.size();

    // initialize thresholds widgets
    for (auto item : decomposition) {
        auto wdg = new ThresholdsWidget(this);
        m_widgets.push_back(wdg);
        wdg->setSignalSource(item);
        layout->addWidget(wdg);
    }

    Q_ASSERT(m_itemsCount == m_widgets.size());
}
开发者ID:SergShtelmakh,项目名称:Wavelet-Denoising,代码行数:46,代码来源:DenoisingWidget.cpp

示例5: QMainWindow

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

    imageViewer = new ImageViewer(this);
    connect(imageViewer, SIGNAL(imageUpdated()), this, SLOT(updateTitle()));

    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setBackgroundRole(QPalette::NoRole);
    scrollArea->setWidget(imageViewer);
    this->setCentralWidget(scrollArea);

    setupToolbar();
    setWindowTitle(QString("%1 %2").arg(PROGRAM_NAME).arg(PROGRAM_VER));

    if (QFile(DEFAULT_IMG).exists())
        loadImage(DEFAULT_IMG);
}
开发者ID:AnnaHojan,项目名称:pto_2014_ania_i_maciek,代码行数:20,代码来源:mainwindow.cpp

示例6: initializeNewTab

void MainWindow::initializeNewTab(const bool &isOpen, const QString &filePath)
{
    ImageArea *imageArea;
    QString fileName(tr("Untitled Image"));
    if(isOpen && filePath.isEmpty())
    {
        imageArea = new ImageArea(isOpen, "", this);
        fileName = imageArea->getFileName();
    }
    else if(isOpen && !filePath.isEmpty())
    {
        imageArea = new ImageArea(isOpen, filePath, this);
        fileName = imageArea->getFileName();
    }
    else
    {
        imageArea = new ImageArea(false, "", this);
    }
    if (!imageArea->getFileName().isNull())
    {
        QScrollArea *scrollArea = new QScrollArea();
        scrollArea->setAttribute(Qt::WA_DeleteOnClose);
        scrollArea->setBackgroundRole(QPalette::Dark);
        scrollArea->setWidget(imageArea);

        mTabWidget->addTab(scrollArea, fileName);
        mTabWidget->setCurrentIndex(mTabWidget->count()-1);

        mUndoStackGroup->addStack(imageArea->getUndoStack());
        connect(imageArea, SIGNAL(sendPrimaryColorView()), mToolbar, SLOT(setPrimaryColorView()));
        connect(imageArea, SIGNAL(sendSecondaryColorView()), mToolbar, SLOT(setSecondaryColorView()));
        connect(imageArea, SIGNAL(sendRestorePreviousInstrument()), this, SLOT(restorePreviousInstrument()));
        connect(imageArea, SIGNAL(sendSetInstrument(InstrumentsEnum)), this, SLOT(setInstrument(InstrumentsEnum)));
        connect(imageArea, SIGNAL(sendNewImageSize(QSize)), this, SLOT(setNewSizeToSizeLabel(QSize)));
        connect(imageArea, SIGNAL(sendCursorPos(QPoint)), this, SLOT(setNewPosToPosLabel(QPoint)));
        connect(imageArea, SIGNAL(sendColor(QColor)), this, SLOT(setCurrentPipetteColor(QColor)));
        connect(imageArea, SIGNAL(sendEnableCopyCutActions(bool)), this, SLOT(enableCopyCutActions(bool)));
        connect(imageArea, SIGNAL(sendEnableSelectionInstrument(bool)), this, SLOT(instumentsAct(bool)));

        setWindowTitle(QString("%1 - EasyPaint").arg(fileName));
    }
开发者ID:3rt,项目名称:EasyPaint,代码行数:41,代码来源:mainwindow.cpp

示例7: QPushButton

DvbEpgDialog::DvbEpgDialog(DvbManager *manager_, QWidget *parent) : KDialog(parent),
	manager(manager_)
{
	setButtons(KDialog::Close);
	setCaption(i18nc("@title:window", "Program Guide"));

	QWidget *widget = new QWidget(this);
	QBoxLayout *mainLayout = new QHBoxLayout(widget);

	epgChannelTableModel = new DvbEpgChannelTableModel(this);
	epgChannelTableModel->setManager(manager);
	channelView = new QTreeView(widget);
	channelView->setMaximumWidth(30 * fontMetrics().averageCharWidth());
	channelView->setModel(epgChannelTableModel);
	channelView->setRootIsDecorated(false);
	channelView->setUniformRowHeights(true);
	connect(channelView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
		this, SLOT(channelActivated(QModelIndex)));
	mainLayout->addWidget(channelView);

	QBoxLayout *rightLayout = new QVBoxLayout();
	QBoxLayout *boxLayout = new QHBoxLayout();

	KAction *scheduleAction = new KAction(QIcon::fromTheme(QLatin1String("media-record")),
		i18nc("@action:inmenu tv show", "Record Show"), this);
	connect(scheduleAction, SIGNAL(triggered()), this, SLOT(scheduleProgram()));

	QPushButton *pushButton =
		new QPushButton(scheduleAction->icon(), scheduleAction->text(), widget);
	connect(pushButton, SIGNAL(clicked()), this, SLOT(scheduleProgram()));
	boxLayout->addWidget(pushButton);

	boxLayout->addWidget(new QLabel(i18nc("@label:textbox", "Search:"), widget));

	epgTableModel = new DvbEpgTableModel(this);
	epgTableModel->setEpgModel(manager->getEpgModel());
	connect(epgTableModel, SIGNAL(layoutChanged()), this, SLOT(checkEntry()));
	KLineEdit *lineEdit = new KLineEdit(widget);
	lineEdit->setClearButtonShown(true);
	connect(lineEdit, SIGNAL(textChanged(QString)),
		epgTableModel, SLOT(setContentFilter(QString)));
	boxLayout->addWidget(lineEdit);
	rightLayout->addLayout(boxLayout);

	epgView = new QTreeView(widget);
	epgView->addAction(scheduleAction);
	epgView->header()->setResizeMode(QHeaderView::ResizeToContents);
	epgView->setContextMenuPolicy(Qt::ActionsContextMenu);
	epgView->setMinimumWidth(75 * fontMetrics().averageCharWidth());
	epgView->setModel(epgTableModel);
	epgView->setRootIsDecorated(false);
	epgView->setUniformRowHeights(true);
	connect(epgView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
		this, SLOT(entryActivated(QModelIndex)));
	rightLayout->addWidget(epgView);

	contentLabel = new QLabel(widget);
	contentLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
	contentLabel->setMargin(5);
	contentLabel->setWordWrap(true);

	QScrollArea *scrollArea = new QScrollArea(widget);
	scrollArea->setBackgroundRole(QPalette::Light);
	scrollArea->setMinimumHeight(12 * fontMetrics().height());
	scrollArea->setWidget(contentLabel);
	scrollArea->setWidgetResizable(true);
	rightLayout->addWidget(scrollArea);
	mainLayout->addLayout(rightLayout);
	setMainWidget(widget);
}
开发者ID:hiroshiyui,项目名称:kaffeine,代码行数:70,代码来源:dvbepgdialog.cpp

示例8: qDebug

void FeatureEval::initialize2(PluginManager * pm) {
    ne_ = pm->findPlugin<NormalEstimator>();
    if (ne_ == nullptr) {
        qDebug() << "Normal estimator plugin needed for normal viz";
        return;
    }

    // GUI STUFF
    visualise_on_ = true;
    function_idx_ = 0;
    layer_idx_ = -1;

    // PARAMS
    subsample_res_ = 0.1;
    subsample_res_2_ = 0.2;
    search_radius_ = 0.2;
    max_nn_ = 20;
    bins_ = 20;

    // Set up viz tab
    depth_widget_ = new QWidget(0);
    tab_idx_ = core_->mw_->addTab(depth_widget_, "Feature visualisation");

    QVBoxLayout * tablayout = new QVBoxLayout(depth_widget_);
    QScrollArea * scrollarea = new QScrollArea();
    scrollarea->setBackgroundRole(QPalette::Dark);
    tablayout->addWidget(scrollarea);
    image_container_ = new QLabel();
    scrollarea->setWidget(image_container_);


    // set up settings
    is_enabled_ = false;
    enable_ = new QAction(QIcon(":/images/featureeval.png"), "Correlate and visualise", 0);
    enable_->setCheckable(true);

    connect(enable_, SIGNAL(triggered()), this, SLOT(enable()));
    mw_->toolbar_->addAction(enable_);
    time = 0;
    settings_ = new QWidget();
    QVBoxLayout * layout = new QVBoxLayout(settings_);
    settings_->setLayout(layout);
    mw_->tooloptions_->addWidget(settings_);

    // settings widgets
    layout->addWidget(new QLabel("Feature"));
    feature_cb_ = new QComboBox(settings_);
    layout->addWidget(feature_cb_);

    // round up parameters
    param_map_["subsample_res"].f = &subsample_res_;
    param_map_["subsample_res.small"].f = &subsample_res_;
    param_map_["subsample_res.big"].f = &subsample_res_2_;
    param_map_["bins"].i =  &bins_;
    param_map_["search_radius"].f = &search_radius_;
    param_map_["max_nn"].i = &max_nn_;

    // round up functions
    feature_cb_->addItem("Difference of normals", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::difference_of_normals, this));
    name_to_function_["difference_of_normals"] = functions_[functions_.size()-1];

    feature_cb_->addItem("intensity_histogram", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::intensity_histogram, this));
    name_to_function_["intensity_histogram"] = functions_[functions_.size()-1];

    feature_cb_->addItem("Fast point feature histograms", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::fast_point_feature_histogram, this));
    name_to_function_["fast_point_feature_histogram"] = functions_[functions_.size()-1];

    feature_cb_->addItem("Curvature", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::curvature, this));
    name_to_function_["curvature"] = functions_[functions_.size()-1];

    feature_cb_->addItem("Distance standard deviation", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::distance_standard_deviation, this));
    name_to_function_["distance_standard_deviation"] = functions_[functions_.size()-1];

    feature_cb_->addItem("Normal standard deviation", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::normal_standard_deviation, this));
    name_to_function_["normal_standard_deviation"] = functions_[functions_.size()-1];

    feature_cb_->addItem("Eigen ratio", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::pca_eigen_value_ratio, this));
    name_to_function_["pca_eigen_value_ratio"] = functions_[functions_.size()-1];

    feature_cb_->addItem("PCA", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::pca, this));
    name_to_function_["pca"] = functions_[functions_.size()-1];

    feature_cb_->addItem("eigen_plane_consine_similarity", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::eigen_plane_consine_similarity, this));
    name_to_function_["eigen_plane_consine_similarity"] = functions_[functions_.size()-1];

    feature_cb_->addItem("intensity", (int)functions_.size());
    functions_.push_back(std::bind(&FeatureEval::intensity, this));
    name_to_function_["intensity"] = functions_[functions_.size()-1];

//    layout->addWidget(new QLabel("Correlate with layer:"));
//    layer_cb_ = new QComboBox(settings_);
//.........这里部分代码省略.........
开发者ID:circlingthesun,项目名称:Masters,代码行数:101,代码来源:featureeval.cpp

示例9: setCentralWidget

CRunGui::CRunGui():Env()
{
	//Env=new CEnvironment();

	//setting of central widget of the window
    QWidget *mainWidget = new QWidget;
    setCentralWidget(mainWidget);

	newEnvDialog = new NewEnvDialog (this);


	//non-gui attributes:
//	Env=NULL;Env is now non dynamic attribute.
//	emit envIsEmpty(true); No need
	NumSteps=-1;
	
	Timer = new QTimer(this);
	connect(Timer,SIGNAL(timeout()),this,SLOT(make1Step()));
	
	//ComboBox - Type of view
	QLabel *typeViewLabel = new QLabel(tr("Type of view: "));
	typeViewLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 

	TypeViewCombo = new QComboBox;
	TypeViewCombo->addItem(TYPE_VIEW_1);
    TypeViewCombo->addItem(TYPE_VIEW_2);
    TypeViewCombo->addItem(TYPE_VIEW_3);
    TypeViewCombo->addItem(TYPE_VIEW_4);
    TypeViewCombo->addItem(TYPE_VIEW_5);
    TypeViewCombo->addItem(TYPE_VIEW_6);
    TypeViewCombo->addItem(TYPE_VIEW_7);


	TypeViewCombo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

	 QVBoxLayout * typeViewLayout= new QVBoxLayout();
	 typeViewLayout->addWidget(typeViewLabel);
	 typeViewLayout->addWidget(TypeViewCombo);
	 //typeViewLayout->addStretch(1);
	
	//Field
	Field= new CField(&Env);

    connect(TypeViewCombo, SIGNAL(currentIndexChanged(const QString &)),Field, SLOT(setTypeView(const QString &)));
	connect(this,SIGNAL(envChanged()),Field,SLOT(renewField()));
	connect (Field,SIGNAL(cellDetails(int,int)),this,SLOT(showCellDetails(int,int)));


	//Legend
	CLegend * legend = new CLegend();
	connect(TypeViewCombo, SIGNAL(activated(const QString &)),legend, SLOT(setTypeView(const QString &)));

	//ScrollArea
	QScrollArea * scrollArea = new QScrollArea ();
	scrollArea->setBackgroundRole(QPalette::Dark);
	scrollArea->setWidget(Field); 

	//Zoom
	ZoomSlid = new ZoomSlider(tr("Zoom: "));
	ZoomSlid->setDisabled(true);
	connect(ZoomSlid,SIGNAL(valueChanged(int)),Field,SLOT(setZoom(int)));


	//Growing Flowers Ratio Slider
	GFSlider = new QSlider(Qt::Horizontal);
	GFSlider->setRange(0, FLOWERGROWINGRATIO_NUM-1);
	GFSlider->setValue(FLOWERGROWINGRATIO_INIT);
	GFSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); 
	connect(GFSlider,SIGNAL(valueChanged(int)),this,SLOT(FlowerGrowingRatioInEnvChanged(int)));

	QLabel * GFLabel=new QLabel("Ratio of growth of flowers: ");
	GFLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 

	QVBoxLayout * GFLayout= new QVBoxLayout();
	GFLayout->addWidget(GFLabel);
	GFLayout->addWidget(GFSlider);


	//connect(this,SIGNAL(envIsEmpty(bool)),ZoomSlid,SLOT(setDisabled(bool)));
	
	//CheckBox for display
	DisplayCheck = new QCheckBox(tr("&Display On"));
	//DisplayCheck->resize(100,30);
	//DisplayCheck->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	connect(DisplayCheck, SIGNAL(stateChanged(int)),this,SLOT(DisplayChanged(int)));
	DisplayCheck->setCheckState(Qt::Checked);
	
	//CheckBox for LearningOn
	LearningCheck = new QCheckBox(tr("&Learning On"));
	connect(LearningCheck, SIGNAL(stateChanged(int)),this,SLOT(LearningChanged(int)));
	if (Env.LearningOn) LearningCheck->setCheckState(Qt::Checked);
	else LearningCheck->setCheckState(Qt::Unchecked);
	
	QVBoxLayout * checksLayout= new QVBoxLayout();
	checksLayout->addWidget(DisplayCheck);
	checksLayout->addWidget(LearningCheck);

	//Time LCD
	
     TimeLCD = new LabeledLCD(tr("Time"));
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:abeetles-svn,代码行数:101,代码来源:CRunGui.cpp

示例10: QMainWindow


//.........这里部分代码省略.........

            // Update labels when a draft event happens
            connect(playerTableModel, &PlayerTableModel::DraftedEnd, [=]() {
                UpdateLabels();
            });

            UpdateLabels();

            ownerSummaryGridLayout->addWidget(budgetLabel,      0, 1);
            ownerSummaryGridLayout->addWidget(numHittersLabel,  1, 1);
            ownerSummaryGridLayout->addWidget(numPitchersLabel, 2, 1);
            ownerSummaryGridLayout->addWidget(maxBidLabel,      3, 1);

            QSpacerItem* spacer = new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::Preferred);

            ownerSummaryGridLayout->addItem(spacer, 0, 2);
            ownerSummaryGridLayout->addItem(spacer, 1, 2);
            ownerSummaryGridLayout->addItem(spacer, 2, 2);
            ownerSummaryGridLayout->addItem(spacer, 3, 2);
            perOwnerLayout->addLayout(ownerSummaryGridLayout);

            perOwnerLayout->addSpacerItem(spacer);
        }

        // Owner widget
        QWidget* scrollAreaWidgetContents = new QWidget(this);
        scrollAreaWidgetContents->setLayout(ownersLayout);
        scrollAreaWidgetContents->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

        // Owner scroll area
        QScrollArea* ownerScrollArea = new QScrollArea(this);
        ownerScrollArea->setWidget(scrollAreaWidgetContents);
        ownerScrollArea->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
        ownerScrollArea->setBackgroundRole(QPalette::Light);
        ownerScrollArea->setFrameShape(QFrame::NoFrame);
        ownerScrollArea->setWidgetResizable(true);

        // Target value widget
        QWidget* targetValueWidget = new QWidget(this);
        QFormLayout* targetValueLayout = new QFormLayout(this);
        targetValueWidget->setLayout(targetValueLayout);
        auto values = {
            PlayerTableModel::COLUMN_AVG,
            PlayerTableModel::COLUMN_HR,
            PlayerTableModel::COLUMN_R,
            PlayerTableModel::COLUMN_RBI,
            PlayerTableModel::COLUMN_SB,
            PlayerTableModel::COLUMN_SO,
            PlayerTableModel::COLUMN_ERA,
            PlayerTableModel::COLUMN_WHIP,
            PlayerTableModel::COLUMN_W,
            PlayerTableModel::COLUMN_SV,
        };
        for (auto value : values) {
            auto name = playerTableModel->headerData(value, Qt::Horizontal, Qt::DisplayRole).toString();
            auto target = QString::number(playerTableModel->GetTargetValue(value), 'f', 3);
            targetValueLayout->addRow(name, new QLabel(target));
        }

        // Player scatter plot
        PlayerScatterPlotChart* chartView = new PlayerScatterPlotChart(playerTableModel, hitterSortFilterProxyModel, this);
        connect(hitterSortFilterProxyModel,  &QSortFilterProxyModel::layoutChanged, chartView, &PlayerScatterPlotChart::Update);
        connect(pitcherSortFilterProxyModel, &QSortFilterProxyModel::layoutChanged, chartView, &PlayerScatterPlotChart::Update);
        connect(playerTableModel, &QAbstractItemModel::dataChanged, chartView, &PlayerScatterPlotChart::Update);

        // Summary view
开发者ID:kspagnoli,项目名称:fbb,代码行数:67,代码来源:old_main.cpp

示例11: CreateLayouts

void Renderer::CreateLayouts() {

	QVBoxLayout *general_layout = new QVBoxLayout;

	// Scroll areas that contains the output image
	QScrollArea *scroll = new QScrollArea;
	scroll->setWidget(image_label_);
	scroll->setBackgroundRole(QPalette::Dark);

	// Group containing the load-related widgets (load zoneplate, image)
	QGroupBox *load = new QGroupBox("Load...");
	QPushButton *load_zone_plate = new QPushButton("Load Zoneplate");
	QPushButton *load_image = new QPushButton("Load Image...");
	QHBoxLayout *layout_load = new QHBoxLayout;
	layout_load->addWidget(load_zone_plate);
	layout_load->addWidget(load_image);
	load->setLayout(layout_load);
	general_layout->addWidget(load);

	// Group containing the resolution-related widgets
	QGroupBox *dimensions = new QGroupBox("Resolution");
	QHBoxLayout *layout_dims = new QHBoxLayout;
	x_dim_ = new QSpinBox; x_dim_->setMinimum(1); x_dim_->setMaximum(1024); x_dim_->setValue(512);
	y_dim_ = new QSpinBox; y_dim_->setMinimum(1); y_dim_->setMaximum(1024); y_dim_->setValue(512);
	QPushButton *change_dimensions = new QPushButton("Change Resolution");
	layout_dims->addWidget(x_dim_);
	layout_dims->addWidget(y_dim_);
	layout_dims->addWidget(change_dimensions);
	dimensions->setLayout(layout_dims);
	general_layout->addWidget(dimensions);

	// Group containing widgets related to the chosen filter
	QGroupBox *filter_parameters = new QGroupBox("Filter and Support");
	QVBoxLayout *filter_parameters_layout = new QVBoxLayout;
	QComboBox *filter_choice = new QComboBox;
	filter_choice->addItem("Box");
	filter_choice->addItem("Bartlett");
	filter_choice->addItem("Welch");
	filter_choice->addItem("Parzen");
	filter_choice->addItem("Hammer");
	filter_choice->addItem("Blackman");
	filter_choice->addItem("Lanczos");
	filter_choice->addItem("Gauss");
	filter_choice->addItem("Mitchell");
	filter_choice->addItem("Dippé");
	filter_choice->addItem("Cook");
	QDoubleSpinBox *support_spin = new QDoubleSpinBox;
	support_spin->setMinimum(0); support_spin->setMaximum(1000); support_spin->setValue(1);
	filter_parameters_layout->addWidget(filter_choice);
	filter_parameters_layout->addWidget(support_spin);
	filter_parameters->setLayout(filter_parameters_layout);
	general_layout->addWidget(filter_parameters);

	// Group containing all paramters about the zoneplate
	zone_plate_modifier_ = new QWidget;
	QHBoxLayout *layout_zone_plate = new QHBoxLayout;
	QSpinBox *size_spin = new QSpinBox; size_spin->setMinimum(1); size_spin->setMaximum(1000); size_spin->setValue(50);
	QSlider *size_slider = new QSlider(Qt::Horizontal);  size_slider->setMinimum(1); size_slider->setMaximum(1000); size_slider->setValue(50);
	freq_spin_ = new QDoubleSpinBox; freq_spin_->setMinimum(0); freq_spin_->setMaximum(1000); freq_spin_->setValue(50);

	QGroupBox *group_size = new QGroupBox("Support Size");
	QVBoxLayout *group_size_layout = new QVBoxLayout;
	group_size_layout->addWidget(size_spin);
	group_size_layout->addWidget(size_slider);
	group_size->setLayout(group_size_layout);
	layout_zone_plate->addWidget(group_size);

	group_freq_ = new QGroupBox("Fixed Frequency");
	QVBoxLayout *group_freq__layout = new QVBoxLayout;
	group_freq__layout->addWidget(freq_spin_);
	group_freq_->setLayout(group_freq__layout);
	group_freq_->setCheckable(true);
	group_freq_->setChecked(false);
	layout_zone_plate->addWidget(group_freq_);

	zone_plate_modifier_->setLayout(layout_zone_plate);
	general_layout->addWidget(zone_plate_modifier_);

	general_layout->addWidget(scroll);

	// Sets the global layout.
	setLayout(general_layout);

	// Creates the needed connections.
	CreateConnections(change_dimensions, load_zone_plate, load_image, size_spin, size_slider, support_spin, filter_choice);

}
开发者ID:White-Link,项目名称:PointSetAnalyser,代码行数:87,代码来源:renderer.cpp

示例12: QMainWindow

TUIMainWindow::TUIMainWindow(QWidget *parent)
    : QMainWindow(parent)
    , port(31802)
    , lastID(-10)
    , serverSN(NULL)
    , clientSN(NULL)
    , dialog(NULL)
    , sConn(NULL)
    , clientConn(NULL)
    , lastElement(NULL)
{
    // init some values
    appwin = this;

#if !defined _WIN32_WCE && !defined ANDROID_TUI
    port = covise::coCoviseConfig::getInt("port", "COVER.TabletPC", 31802);
#else
    port = 31802;
#endif
#ifndef _WIN32
    signal(SIGPIPE, SIG_IGN); // otherwise writes to a closed socket kill the application.
#endif

    // initialize two timer
    // timer.....waits for disconneting vrb clients

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));

// create the menus and toolbar buttons
//createMenubar();
#ifndef _WIN32_WCE
    createToolbar();
#endif

    // widget that contains the main windows(mainFrame)

    QWidget *w;
#ifdef _WIN32_WCE
    QScrollArea *scrollArea = new QScrollArea;
    scrollArea->setBackgroundRole(QPalette::Dark);
    w = scrollArea;
#else
    w = new QWidget(this);
    QScrollArea *scrollArea = new QScrollArea();
    scrollArea->setBackgroundRole(QPalette::Dark);
    scrollArea->setWidgetResizable(true);
    scrollArea->setWidget(w);
#endif

    QVBoxLayout *vbox = new QVBoxLayout(w);

// main windows
#ifdef _WIN32_WCE
    mainFrame = new QFrame(w);
    mainFrame->setContentsMargins(1, 1, 1, 1);
#else
    mainFrame = new QFrame();
    mainFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    mainFrame->setContentsMargins(2, 2, 2, 2);
#endif
    vbox->addWidget(mainFrame, 1);

    // main layout
    mainGrid = new QGridLayout(mainFrame);

    setFont(mainFont);

#ifdef _WIN32_WCE
    setWindowTitle("COVISE: PocketUI");
    setCentralWidget(w);
#else
    setWindowTitle("COVISE: TabletUI");
    setCentralWidget(scrollArea);
#endif

    // set a logo &size
    setWindowIcon(QPixmap(logo));
#ifdef _WIN32_WCE
    setMaximumWidth(480);
    setMaximumHeight(480);
#else
    resize(800, 600);
#endif
}
开发者ID:dwickeroth,项目名称:covise,代码行数:85,代码来源:TUIApplication.cpp

示例13: QMainWindow

TextEdit::TextEdit(QWidget *parent)
  : QMainWindow(parent)
{
  setToolButtonStyle(Qt::ToolButtonFollowStyle);
  setupFileActions();
  setupEditActions();
  setupTextActions();

  {
//    QMenu *helpMenu = new QMenu(tr("Help"), this);
//    menuBar()->addMenu(helpMenu);
//    helpMenu->addAction(tr("About"), this, SLOT(about()));
//    helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
  }

  textEdit = new QTextEdit(this);
  //////////////////////////////////////////////////
  connect(textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
          this, SLOT(currentCharFormatChanged(QTextCharFormat)));
  connect(textEdit, SIGNAL(cursorPositionChanged()),
          this, SLOT(cursorPositionChanged()));

  ///////////
  //setCentralWidget(textEdit);
  //blank=new Blank(this);
  //setCentralWidget(blank);


  //create a transparent canvas and put it on the top of textEdit
  image =new MyCanvas(900,800,this);
  textEdit->setFixedSize(QSize(800,800));
  textEdit->setBackgroundRole(QPalette::Light);   //scrollArea对象的背景色设为Dark
  image->setFixedSize(QSize(800,800));
  image->setStyleSheet(QString::fromUtf8("border:1px solid #000000;"));

  QScrollArea* scrollArea = new QScrollArea;
  scrollArea->setFixedSize(QSize(1800,900));
  //scrollArea->setWidget(image);     //将画布添加到scrollArea中
  scrollArea->setBackgroundRole(QPalette::Light);   //scrollArea对象的背景色设为Dark
  //scrollArea->setBackgroundColor(QColor::white);

//    QStackedLayout *stackedLayout = new QStackedLayout;
//    stackedLayout->addWidget(image);
//    stackedLayout->addWidget(textEdit);
//    stackedLayout->setStackingMode(QStackedLayout::StackAll);

  QHBoxLayout* hLayout=new QHBoxLayout();
  hLayout->addWidget(textEdit);
  hLayout->addWidget(image);
//  scrollArea->setLayout(stackedLayout);
  scrollArea->setLayout(hLayout);
  //scrollArea->setGeometry(QRect(50,50,800,800));



  setCentralWidget(scrollArea);    //将scrollArea加入到主窗口的中心区new QPainter(this);
  scrollArea->setAlignment(Qt::AlignHCenter);
  //after canvas handle the mouse-drag event, emit it to the edittext for farther handling
  connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),this,SLOT(onMouseMove(QMouseEvent*)));
  //connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),textEdit,SLOT(mouseMoveEvent(QMouseEvent*)));
  //connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),textEdit,SLOT(cursorPositionChanged(QMouseEvent*)));
  //connect(this,SIGNAL(mouseMoveSig(QMouseEvent*)),image,SLOT(mouseMoveSlot(QMouseEvent*)));
  //connect(textEdit,SIGNAL(mouseMoveEvent(QMouseEvent*)),image,SLOT(mouseMoveSlot(QMouseEvent*)));

  // textEdit->setFocus();
  setCurrentFileName(QString());

  fontChanged(textEdit->font());
  colorChanged(textEdit->textColor());
  alignmentChanged(textEdit->alignment());

  connect(textEdit->document(), SIGNAL(modificationChanged(bool)),
          actionSave, SLOT(setEnabled(bool)));
  connect(textEdit->document(), SIGNAL(modificationChanged(bool)),
          this, SLOT(setWindowModified(bool)));
  connect(textEdit->document(), SIGNAL(undoAvailable(bool)),
          actionUndo, SLOT(setEnabled(bool)));
  connect(textEdit->document(), SIGNAL(redoAvailable(bool)),
          actionRedo, SLOT(setEnabled(bool)));

  setWindowModified(textEdit->document()->isModified());
  actionSave->setEnabled(textEdit->document()->isModified());
  actionUndo->setEnabled(textEdit->document()->isUndoAvailable());
  actionRedo->setEnabled(textEdit->document()->isRedoAvailable());

  connect(actionUndo, SIGNAL(triggered()), textEdit, SLOT(undo()));
  connect(actionRedo, SIGNAL(triggered()), textEdit, SLOT(redo()));

  actionCut->setEnabled(false);
  actionCopy->setEnabled(false);

  connect(actionCut, SIGNAL(triggered()), textEdit, SLOT(cut()));
  connect(actionCopy, SIGNAL(triggered()), textEdit, SLOT(copy()));
  connect(actionPaste, SIGNAL(triggered()), textEdit, SLOT(paste()));

  connect(textEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool)));
  connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool)));

#ifndef QT_NO_CLIPBOARD
  connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
//.........这里部分代码省略.........
开发者ID:counterstriker,项目名称:qtapplications,代码行数:101,代码来源:textedit.cpp


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