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


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

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


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

示例1: reloadData

void StackedWidget::reloadData() {
	removePages();

	DataManager& manager = DataManager::getInstance();

	if( manager.isempty() ) {
		addWidget( new QLabel(tr("No quantities found.")) );
		return;
	}

	//Home
	StackedWidgetHome *home = new StackedWidgetHome(this);
	addWidget(home);
	connect(home, &StackedWidgetHome::quantityChosen, this, &StackedWidget::quantityChosen);

	//all quantities
	for(Quantity& quantity : manager) {
		QScrollArea *scroll = new QScrollArea(this);
		scroll->setWidgetResizable(true);
		scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
		scroll->setWidget(new QuantityWidget( quantity, this ));
		addWidget(scroll);
	}

	QStackedWidget::update();
}
开发者ID:Daimanu06,项目名称:QuantiC,代码行数:26,代码来源:stackedwidget.cpp

示例2: QDockWidget

PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setObjectName("palette-box");
      setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

      QScrollArea* sa = new QScrollArea;
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      setWidget(sa);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      _dirty = false;
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();

//      connect(sa, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&)));
      }
开发者ID:uwei,项目名称:MuseScore,代码行数:26,代码来源:palettebox.cpp

示例3: QMdiSubWindow

/*!
  \brief Constructor.
  Creates a new instance of ProjectWindow.
  \param pro project data to show, not null.
  \param parent parent widgets of this window, default value is 0.
 */
Ui::ProjectWindow::ProjectWindow(Core::Project *pro, QWidget *parent /* = 0 */)
        : QMdiSubWindow(parent),
          project(pro)
{
    // entry conditions
    Q_CHECK_PTR(pro);

    setAttribute(Qt::WA_DeleteOnClose);

    setWindowIcon(QIcon(":/proj"));
    setWindowTitle(project->name());
    setMinimumSize(200, 200);

    // project view, the main widget
    view = new ProjectView(this);
    scene = new ProjectScene(project, this);
    view->setScene(scene);
    view->setSceneRect(0, 0, project->width(), project->height());
    QScrollArea* centerPanel = new QScrollArea(this);
    centerPanel->viewport()->setStyleSheet(QString("background-color:#C0C0C0"));
    centerPanel->setAlignment(Qt::AlignCenter);
    centerPanel->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    centerPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    centerPanel->setWidget(view);

    // status bar
    statusBar = new QWidget(this);
    QHBoxLayout *statusLayout = new QHBoxLayout(statusBar);
    statusLayout->setMargin(0);
    statusBar->setLayout(statusLayout);
    QLineEdit* percentInput = new QLineEdit(statusBar);
    percentInput->setText("100");
    percentInput->setFixedSize(40, 18);
    QLabel *msgLabel = new QLabel(statusBar);
    msgLabel->setText("%");
    msgLabel->setFixedWidth(8);
    QPushButton *gridButton = new QPushButton(statusBar);
    gridButton->setText("#");
    gridButton->setCheckable(true);
    gridButton->setFixedSize(20, 18);
    QLabel *ctrlLabel = new QLabel(statusBar);
    ctrlLabel->setFixedWidth(qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) - 6);
    statusLayout->addWidget(percentInput);
    statusLayout->addWidget(msgLabel);
    statusLayout->addWidget(gridButton);
    statusLayout->addWidget(centerPanel->horizontalScrollBar(), 100);
    statusLayout->addWidget(ctrlLabel);

    QWidget *mainPanel = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addWidget(centerPanel);
    mainLayout->addWidget(statusBar);
    mainPanel->setLayout(mainLayout);
    setWidget(mainPanel);

    connect(gridButton, SIGNAL(clicked(bool)), scene, SLOT(showGrid(bool)));
    connect(appCtx->mainWindow(), SIGNAL(antialiasingChanged(bool)), scene, SLOT(setAntialiasing(bool)));
}
开发者ID:jaisurya,项目名称:picworks,代码行数:66,代码来源:projectwindow.cpp

示例4: QWidget

EffectStackEdit::EffectStackEdit(QWidget *parent) :
        QWidget(parent),
        m_in(0),
        m_out(0),
        m_frameSize(QPoint())
{
    setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
    QVBoxLayout *vbox1 = new QVBoxLayout(parent);
    vbox1->setContentsMargins(0, 0, 0, 0);
    vbox1->setSpacing(0);

    QScrollArea *area = new QScrollArea;
    QWidget *wid = new QWidget(parent);
    area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    wid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    area->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));

    vbox1->addWidget(area);
    area->setWidget(wid);
    area->setWidgetResizable(true);
    m_vbox = new QVBoxLayout(wid);
    m_vbox->setContentsMargins(0, 0, 0, 0);
    m_vbox->setSpacing(0);
    wid->show();

}
开发者ID:rayl,项目名称:kdenlive,代码行数:27,代码来源:effectstackedit.cpp

示例5: image

    MainWindow(QWidget* parent) {
        resize(800, 600);

        QLabel* imageLabel = new QLabel;
        QImage image("sample.png");
        imageLabel->setPixmap(QPixmap::fromImage(image));
        QWidget* wdg = imageLabel;

        // Standard QScrollArea will add scroll bars around the image label
        QScrollArea* scrollArea = new QScrollArea(this);

        // The UnboundedScrollArea shows how it should look like
        //QScrollArea* scrollArea = new UnboundedScrollArea(this);

        scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded);
        scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded);
        scrollArea->setWidget(wdg);

        QGridLayout* layout = new QGridLayout();
        layout->setMargin(0);
        layout->setHorizontalSpacing(0);
        layout->setVerticalSpacing(0);
        layout->setRowStretch(0, 1);
        layout->setRowStretch(2, 1);
        layout->setColumnStretch(0, 1);
        layout->setColumnStretch(2, 1);
        layout->addWidget(scrollArea, 1, 1);

        QWidget* centralWidget = new QWidget(this);
        centralWidget->setLayout(layout);
        setCentralWidget(centralWidget);
    }
开发者ID:afester,项目名称:CodeSamples,代码行数:32,代码来源:main.cpp

示例6: QwtLegend

//---------------------------------------------------------------------------
PlotLegend::PlotLegend( QWidget *parent ):
        QwtLegend( parent )
{
    setMinimumHeight( 1 );
    setMaxColumns( 1 );
    setContentsMargins( 0, 0, 0, 0 );

    QLayout* layout = contentsWidget()->layout();
    layout->setAlignment( Qt::AlignLeft | Qt::AlignTop );
    layout->setSpacing( 0 );

    QScrollArea *scrollArea = findChild<QScrollArea *>();
    if ( scrollArea )
    {
        scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
        scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    }

#if 1
    QFont fnt = font();
    if ( fnt.pointSize() > 8 )
    {
        fnt.setPointSize( 8 );
        setFont( fnt );
    }
#endif
}
开发者ID:ElderOrb,项目名称:qctools,代码行数:28,代码来源:PlotLegend.cpp

示例7: CreatePartControl

void QmitkFunctionality::CreatePartControl(void* parent)
{

  // scrollArea
  QScrollArea* scrollArea = new QScrollArea;  
  //QVBoxLayout* scrollAreaLayout = new QVBoxLayout(scrollArea);
  scrollArea->setFrameShadow(QFrame::Plain);
  scrollArea->setFrameShape(QFrame::NoFrame);
  scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

  // m_Parent
  m_Parent = new QWidget;
  //m_Parent->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
  this->CreateQtPartControl(m_Parent);

  //scrollAreaLayout->addWidget(m_Parent);
  //scrollArea->setLayout(scrollAreaLayout);

  // set the widget now
  scrollArea->setWidgetResizable(true);
  scrollArea->setWidget(m_Parent);

  // add the scroll area to the real parent (the view tabbar)
  QWidget* parentQWidget = static_cast<QWidget*>(parent);
  QVBoxLayout* parentLayout = new QVBoxLayout(parentQWidget);
  parentLayout->setMargin(0);
  parentLayout->setSpacing(0);
  parentLayout->addWidget(scrollArea);

  // finally set the layout containing the scroll area to the parent widget (= show it)
  parentQWidget->setLayout(parentLayout);

  this->AfterCreateQtPartControl();
}
开发者ID:david-guerrero,项目名称:MITK,代码行数:35,代码来源:QmitkFunctionality.cpp

示例8: slotMenuAboutNews

void RenderWindow::slotMenuAboutNews()
{
	QString filename = systemData.docDir + "NEWS";

	QFile f(filename);
	QString text = "";
	if (f.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		text = f.readAll();
	}

	QLabel *label = new QLabel;
	label->setText(text);
	label->setWordWrap(true);
	label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);

	QScrollArea *scroll = new QScrollArea();
	scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
	scroll->setWidget(label);
	scroll->setWidgetResizable(true);

	QHBoxLayout *layout = new QHBoxLayout();
	layout->addWidget(scroll);
	QDialog *dialog = new QDialog();
	dialog->setLayout(layout);
	dialog->setWindowTitle(QObject::tr("News"));
	dialog->show();
}
开发者ID:mancoast,项目名称:mandelbulber2,代码行数:28,代码来源:render_window_menu.cpp

示例9: QWidget

NotifyManager::NotifyManager(QWidget *parent) :
    QWidget(parent),
    m_dbus(new Notification("com.deepin.dde.Notification", "/com/deepin/dde/Notification", QDBusConnection::sessionBus(), this))
{
    QWidget *widget = new QWidget;

    m_connectLayout = new QVBoxLayout(widget);
    m_connectLayout->setMargin(0);
    m_connectLayout->setSpacing(1);
    m_connectLayout->addStretch();

    QScrollArea *scrollarea = new QScrollArea;
    scrollarea->setWidget(widget);
    scrollarea->setObjectName("scrollarea");
    scrollarea->setWidgetResizable(true);
    scrollarea->setFocusPolicy(Qt::NoFocus);
    scrollarea->setFrameStyle(QFrame::NoFrame);
    scrollarea->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
    scrollarea->setContentsMargins(0, 0, 0, 0);
    scrollarea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollarea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollarea->setStyleSheet("background-color:transparent;");

    QScrollBar *bar = scrollarea->verticalScrollBar();
    connect(bar, &QScrollBar::valueChanged, this, [=](int value){
            if (m_checkIndex && value == bar->maximum())
                onLoadAgain();
    });

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    m_clearButton = new DImageButton;
    m_clearButton->setText(tr("Clear all"));
    m_clearButton->setStyleSheet("padding: 4px 0;");

    mainLayout->addWidget(m_clearButton, 0, Qt::AlignHCenter);
    mainLayout->addWidget(scrollarea);

    setLayout(mainLayout);

    m_clearButton->setVisible(false);

    connect(m_clearButton, &DImageButton::clicked, this, &NotifyManager::onCloseAllItem);
    connect(m_dbus, &Notification::RecordAdded, this, &NotifyManager::onNotifyAdded);

    m_dbus->setSync(false);

    QDBusPendingReply<QString> notify = m_dbus->GetAllRecords();
    QDBusPendingCallWatcher *notifyWatcher = new QDBusPendingCallWatcher(notify, this);
    connect(notifyWatcher, &QDBusPendingCallWatcher::finished, this, &NotifyManager::onNotifyGetAllFinished);
}
开发者ID:ghj1040110333,项目名称:dde-control-center,代码行数:53,代码来源:notifymanager.cpp

示例10: if

_choicedialog::_choicedialog(QWidget* _parent, QString _sAllowed) : QDialog(_parent)
{
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowFlags(windowFlags() | Qt::Tool);

  QVBoxLayout *j = new QVBoxLayout();
  setLayout(j);

  QWidget *g = new QWidget();

  QVBoxLayout *jj = new QVBoxLayout();
  g->setLayout(jj);
  QScrollArea *a = new QScrollArea(this);
  a->setWidget(g);
  a->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  a->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); 
  a->setWidgetResizable(true);

  QStringList l;
  if (_sAllowed.contains(";")) l = _sAllowed.split(";");
  else if (_sAllowed.contains(",")) l = _sAllowed.split(",");
  
  for (int i = 0; i < l.size(); i++){   
    
    pref[l.at(i)] = new QCheckBox(l.at(i), g); 
    QCheckBox *c = pref[l.at(i)];
    jj->addWidget(c);
    c->setChecked(sSet.contains(l.at(i)));
  }

  j->addWidget(a);

  setWindowTitle(tr("Selectable Properties"));
  setModal(true);
  
  QWidget *f = new QWidget();
  QHBoxLayout *fj = new QHBoxLayout();
  f->setLayout(fj);
  j->addWidget(f);
 
  QPushButton *p;

  p = new QPushButton(tr("&Ok"), f); fj->addWidget(p);
  connect(p, SIGNAL( clicked() ), this, SLOT(performClose()) );
 
  move(QApplication::desktop()->width() / 2 - sizeHint().width() / 2, QApplication::desktop()->height() / 2 - sizeHint().height() / 2);
  
  qApp->setActiveWindow(this);

  exec();
  
}
开发者ID:DamianSuess,项目名称:kbasic,代码行数:52,代码来源:_choicedialog.cpp

示例11: QWidget

QWidget *TilesetItemBox::makeCategory(const QString &categoryItem)
{
    QTabWidget *TileSetsCategories = ui->TileSetsCategories;
    QWidget *catWid;
    QWidget *scrollWid;
    QGridLayout *catLayout;
    QLabel *grpLabel;
    QComboBox *tilesetGroup;
    QSpacerItem *spItem;
    QScrollArea *TileSets;
    FlowLayout *theLayOut;


    catWid = new QWidget();
    scrollWid = new QWidget();
    catLayout = new QGridLayout(catWid);
    catLayout->setSpacing(0);
    catLayout->setContentsMargins(0, 0, 0, 0);
    grpLabel = new QLabel(catWid);
    grpLabel->setText(tr("Group:"));
    catLayout->addWidget(grpLabel, 0, 0, 1, 1);

    tilesetGroup = new QComboBox(catWid);

    catLayout->addWidget(tilesetGroup, 0, 1, 1, 1);
    tilesetGroup->setInsertPolicy(QComboBox::InsertAlphabetically);
    spItem = new QSpacerItem(1283, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    catLayout->addItem(spItem, 0, 2, 1, 1);
    TileSets = new QScrollArea(catWid);
    TileSets->setWidget(scrollWid);
    TileSets->setWidgetResizable(true);
    TileSets->setFrameShape(QFrame::StyledPanel);
    TileSets->setFrameShadow(QFrame::Raised);
    TileSets->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    TileSets->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    theLayOut = new FlowLayout(scrollWid);
    theLayOut->setSizeConstraint(QLayout::SetNoConstraint);

    catLayout->addWidget(TileSets, 1, 0, 1, 3);

    TileSetsCategories->addTab(catWid, QString());
    TileSetsCategories->setTabText(TileSetsCategories->indexOf(catWid), categoryItem);

    return catWid;
}
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:46,代码来源:tileset_item_box.cpp

示例12: QWidget

TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::TrackInfoWidget )
{
    QWidget* widget = new QWidget;
    m_headerWidget = new BasicHeader;
    ui->setupUi( widget );

    m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultTrackImage, TomahawkUtils::Original, QSize( 48, 48 ) );

    m_relatedTracksModel = new PlayableModel( ui->trackView );
    ui->trackView->trackView()->setPlayableModel( m_relatedTracksModel );
    ui->trackView->setCaption( tr( "Similar Tracks" ) );
    ui->trackView->setEmptyTip( tr( "Sorry, but we could not find similar tracks for this song!" ) );

    ui->topHits->setStyleSheet( QString( "QListView { background-color: #f9f9f9; }" ) );
    TomahawkStyle::stylePageFrame( ui->trackFrame );
    ui->topHits->setVisible( false );
    ui->topHitsLabel->setVisible( false );

    {
        QScrollArea* area = new QScrollArea();
        area->setWidgetResizable( true );
        area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
        area->setWidget( widget );

        QPalette pal = palette();
        pal.setBrush( backgroundRole(), Qt::white );
        area->setPalette( pal );
        area->setAutoFillBackground( true );
        area->setFrameShape( QFrame::NoFrame );
        area->setAttribute( Qt::WA_MacShowFocusRect, 0 );

        QVBoxLayout* layout = new QVBoxLayout();
        layout->addWidget( m_headerWidget );
        layout->addWidget( area );
        setLayout( layout );
        TomahawkUtils::unmarginLayout( layout );
    }

    load( query );
}
开发者ID:Alex237,项目名称:tomahawk,代码行数:42,代码来源:TrackViewPage.cpp

示例13: initWidget

    void CChatWidget::initWidget()
    {
        QGridLayout* pMainLayout = new QGridLayout(this);
        setLayout(pMainLayout);

        m_pChatListWidget = new QWidget(this);
        pMainLayout->addWidget(m_pChatListWidget, 0, 0, 10, 2, Qt::AlignLeft);

        m_pPeerInfoWidget = new QWidget(this);
        pMainLayout->addWidget(m_pPeerInfoWidget, 0, 2, 2, 8);
        QHBoxLayout* pPeerInfoLayout = new QHBoxLayout(m_pPeerInfoWidget);
        m_pPeerInfoWidget->setLayout(pPeerInfoLayout);
        pPeerInfoLayout->addWidget(new QLabel(tr("name"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("ip"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("port"), m_pPeerInfoWidget));

        m_pRecordWidget = new QWidget(this);
        m_pRecordWidget->setLayout(new QVBoxLayout(m_pRecordWidget));
        QScrollArea* pLogArea = new QScrollArea(this);
        pLogArea->setWidget(m_pRecordWidget);
        pLogArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        pLogArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        pMainLayout->addWidget(pLogArea, 2, 2, 5, 8);

        pLogArea->setWidgetResizable(true);
        pLogArea->setStyleSheet(
                    "QWidget{background-color: transparent;} QScrollArea{background-color: rgba(255, 255, 255, 59);}");

        m_psbRecord = pLogArea->verticalScrollBar();

        QWidget* pInputWidget = new QWidget(this);
        pMainLayout->addWidget(pInputWidget, 7, 2, 3, 8);
        QHBoxLayout* pInputLayout = new QHBoxLayout(pInputWidget);
        pInputWidget->setLayout(pInputLayout);
        m_pteInput = new QTextEdit(pInputWidget);
        pInputLayout->addWidget(m_pteInput);
        QPushButton* pbtnSend = new QPushButton(tr("send"), pInputWidget);
        pInputLayout->addWidget(pbtnSend);

        bool VARIABLE_IS_NOT_USED bIsSendConOK = connect(pbtnSend, SIGNAL(clicked()), this, SLOT(sendButtonClicked()));
        Q_ASSERT(bIsSendConOK);
    }
开发者ID:fufesou,项目名称:PengGe,代码行数:42,代码来源:chatwidget.cpp

示例14: CircleWidget

QWidget *StartWidget::createPluginsList()
{
	QWidget * const circleWidget = new CircleWidget(QSize(70, 70), ":/mainWindow/images/startTab/new.svg");
	circleWidget->setStyleSheet(BrandManager::styles()->startTabButtonStyle());

	QVBoxLayout * const innerLayout = new QVBoxLayout;
	innerLayout->addStretch();
	foreach (const Id &editor, mMainWindow->editorManager().editors()) {
		const Id editorTmpId = Id::loadFromString("qrm:/" + editor.editor());
		foreach (const Id &diagram, mMainWindow->editorManager().diagrams(editorTmpId)) {
			QWidget * const pluginWidget = createPluginButton(editor, diagram, circleWidget);
			innerLayout->addWidget(pluginWidget);
		}
	}

	innerLayout->addStretch();
	innerLayout->setContentsMargins(0, 0, 0, 0);
	innerLayout->setMargin(0);
	innerLayout->setSpacing(0);

	QWidget *innerWidget = new QWidget;
	innerWidget->setLayout(innerLayout);

	QScrollArea *scrollArea = new QScrollArea;
	scrollArea->setFrameShape(QFrame::NoFrame);
	scrollArea->setWidgetResizable(true);
	scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidget(innerWidget);

	QHBoxLayout * const mainLayout = new QHBoxLayout;
	mainLayout->addWidget(circleWidget, Qt::AlignCenter);
	mainLayout->addWidget(scrollArea);
	mainLayout->setStretch(0, 0);
	mainLayout->setStretch(1, 10);
	mainLayout->setMargin(0);

	QWidget * const result = new QWidget;
	result->setLayout(mainLayout);

	return result;
}
开发者ID:Antropovi,项目名称:qreal,代码行数:42,代码来源:startWidget.cpp

示例15: NoteEditor

/**
 * \brief    Constructeur de l'éditeur de document
 * \param    d  document ressource
 */
DocumentEditor::DocumentEditor(Document *d, QWidget *parent) :
    NoteEditor(d, parent), resource(d){

    // add or create note
    QPushButton* addBtn = new QPushButton("Ajouter une note existante");
    QObject::connect(addBtn, SIGNAL(clicked()), this, SLOT(addFront()));
    QPushButton* createBtn = new QPushButton("Créer une note");
    QObject::connect(createBtn, SIGNAL(clicked()), this, SLOT(createFront()));
    QHBoxLayout* addLayout = new QHBoxLayout();
    addLayout->addWidget(addBtn);
    addLayout->addWidget(createBtn);

    // scroll area
    QWidget* mainWidget = new QWidget(this);
    QVBoxLayout * vLayout = new QVBoxLayout(mainWidget);
    QScrollArea * scrollArea = new QScrollArea(mainWidget);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setWidgetResizable(false);
    scrollLayout = new QVBoxLayout;
    QWidget* scrollAreaWidgetContents = new QWidget;
    for (Document::iterator it = d->begin(); it != d->end(); ++it){
        DocumentEditorRow* row = new DocumentEditorRow(*it, this);
        rows.push_back(row);
        scrollLayout->addWidget(rows.back());
        QObject::connect(row, SIGNAL(onMoveUp(DocumentEditorRow*)), this, SLOT(moveUp(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onMoveDown(DocumentEditorRow*)), this, SLOT(moveDown(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onEdit(DocumentEditorRow*)), this, SLOT(edit(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onSupress(DocumentEditorRow*)), this, SLOT(supress(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onAdd(DocumentEditorRow*)), this, SLOT(add(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onCreate(DocumentEditorRow*)), this, SLOT(create(DocumentEditorRow*)));
    }
    scrollAreaWidgetContents->setLayout(scrollLayout);
    scrollLayout->setSizeConstraint(QLayout::SetFixedSize);
    scrollArea->setWidget(scrollAreaWidgetContents);
    vLayout->addWidget(scrollArea);

    // layout
    layout->addLayout(addLayout);
    layout->addWidget(mainWidget);
}
开发者ID:pporcher,项目名称:notes-manager,代码行数:45,代码来源:Editor.cpp


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