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


C++ setHorizontalScrollBarPolicy函数代码示例

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


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

示例1: QScrollArea

ExamplesPreview::ExamplesPreview(int engine, QWidget *parent) : QScrollArea(parent)
{
    setWindowFlags(windowFlags() | Qt::ToolTip);
    setAutoFillBackground(true);

    setFrameStyle(QFrame::Box | QFrame::Plain);
    setFixedSize(300, 300);
    setWidgetResizable(true);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QWidget *widget = new QWidget(this);
    widget->setFixedWidth(280);
    QVBoxLayout *l = new QVBoxLayout(widget);
    l->setSpacing(0);

    QPalette p(palette());
    p.setColor(QPalette::Window, QColor("#c0daff"));
    setPalette(p);

    static const QStringList filters[ENGINE_MAX] =
    {
        (QStringList() << "*.js"),
        (QStringList() << "*.py")
    };

    QDir dir(":/examples");
    QStringList files = dir.entryList(filters[engine], QDir::NoFilter, QDir::Name);
    QFile f;
    for(int i = 0; i < files.size(); ++i)
    {
        f.setFileName(":/examples/" + files[i]);
        if(!f.open(QIODevice::ReadOnly))
            continue;

        ExamplePreviewItem *prev = new ExamplePreviewItem(files[i], f.readLine(), this);
        connect(prev, SIGNAL(openInEditor(QString)), SIGNAL(openInEditor(QString)));
        connect(prev, SIGNAL(openPreview(QString)),  SIGNAL(openPreview(QString)));

        l->addWidget(prev);
        l->addWidget(getSeparator());

        f.close();
    }
    setWidget(widget);

    connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), SLOT(focusChanged(QWidget*, QWidget*)));
}
开发者ID:onenonlycasper,项目名称:Lorris,代码行数:47,代码来源:scripteditor.cpp

示例2: QGraphicsScene

Game::Game(QWidget *parent){
    // create the scene
    scene = new QGraphicsScene();
    scene->setSceneRect(0,0,1000,800); // make the scene 800x600 instead of infinity by infinity (default)

    setBackgroundBrush(QBrush(QImage(":/images/bg.jpg")));

    // make the newly created scene the scene to visualize (since Game is a QGraphicsView Widget,
    // it can be used to visualize scenes)
    setScene(scene);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setFixedSize(1000,800);

    // create the player
    player = new MyRect();
    //player->setRect(0,0,100,100); // change the rect from 0x0 (default) to 100x100 pixels
    player->setPos(400,500); // TODO generalize to always be in the middle bottom of screen
    // make the player focusable and set it to be the current focus
    player->setFlag(QGraphicsItem::ItemIsFocusable);
    player->setFocus();
    // add the player to the scene
    scene->addItem(player);

    // create the score/health
    score = new Score();
    scene->addItem(score);
    health = new Health();
    health->setPos(health->x(),health->y()+25);
    scene->addItem(health);

    // spawn enemies
    QTimer * timer = new QTimer();
    QObject::connect(timer,SIGNAL(timeout()),player,SLOT(spawn()));
    timer->start(2000);



    // play background music
    QMediaPlayer * music = new QMediaPlayer();
    music->setMedia(QUrl("qrc:/sounds/Counter-strike_1.6-Zak_Belica_(glavnaya_tema_-_fonovaya_muzyka_v_nachale_igry).mp3"));
    music->play();



    show();
}
开发者ID:Tarazali,项目名称:C-Game,代码行数:47,代码来源:Game.cpp

示例3: QTableView

StageListView::StageListView(QWidget* parent)
:	QTableView(parent),
	m_sizeHint(QTableView::sizeHint()),
	m_pModel(0),
	m_pFirstColDelegate(new LeftColDelegate(this)),
	m_pSecondColDelegate(new RightColDelegate(this)),
	m_curBatchAnimationFrame(0),
	m_timerId(0),
	m_batchProcessingPossible(false),
	m_batchProcessingInProgress(false)
{
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	
	// Prevent current item visualization. Not to be confused
	// with selected items.
	m_pFirstColDelegate->flagsForceDisabled(QStyle::State_HasFocus);
	m_pSecondColDelegate->flagsForceDisabled(QStyle::State_HasFocus);
	setItemDelegateForColumn(0, m_pFirstColDelegate);
	setItemDelegateForColumn(1, m_pSecondColDelegate);
	
	QHeaderView* h_header = horizontalHeader();
	h_header->setResizeMode(QHeaderView::Stretch);
	h_header->hide();
	
	QHeaderView* v_header = verticalHeader();
	v_header->setResizeMode(QHeaderView::ResizeToContents);
	v_header->setMovable(false);
	
	m_pLaunchBtn = new SkinnedButton(
		":/icons/play-small.png",
		":/icons/play-small-hovered.png",
		":/icons/play-small-pressed.png",
		viewport()
	);
	m_pLaunchBtn->setStatusTip(tr("Launch batch processing"));
	m_pLaunchBtn->hide();
	
	connect(
		m_pLaunchBtn, SIGNAL(clicked()),
		this, SIGNAL(launchBatchProcessing())
	);
	
	connect(
		verticalScrollBar(), SIGNAL(rangeChanged(int, int)),
		this, SLOT(ensureSelectedRowVisible()), Qt::QueuedConnection
	);
}
开发者ID:DevangThakkar,项目名称:scantailor,代码行数:47,代码来源:StageListView.cpp

示例4: QGraphicsView

/*
 * Initialize the widget
 */
GpsConstellationWidget::GpsConstellationWidget(QWidget *parent) : QGraphicsView(parent)
{

    // Create a layout, add a QGraphicsView and put the SVG inside.
    // The constellation widget looks like this:
    // |--------------------|
    // |                    |
    // |                    |
    // |     Constellation  |
    // |                    |
    // |                    |
    // |                    |
    // |--------------------|


    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QSvgRenderer *renderer = new QSvgRenderer();
    renderer->load(QString(":/gpsgadget/images/gpsEarth.svg"));

    world = new QGraphicsSvgItem();
    world->setSharedRenderer(renderer);
    world->setElementId("map");

    scene = new QGraphicsScene(this);
    scene->addItem(world);
    scene->setSceneRect(world->boundingRect());
    setScene(scene);

    // Now create 'maxSatellites' satellite icons which we will move around on the map:
    for (int i=0; i < MAX_SATTELITES;i++) {
        satellites[i][0] = 0;
        satellites[i][1] = 0;
        satellites[i][2] = 0;
        satellites[i][3] = 0;

        satIcons[i] = new QGraphicsSvgItem(world);
        satIcons[i]->setSharedRenderer(renderer);
        satIcons[i]->setElementId("sat-notSeen");
        satIcons[i]->hide();

        satTexts[i] = new QGraphicsSimpleTextItem("##",satIcons[i]);
        satTexts[i]->setBrush(QColor("Black"));
        satTexts[i]->setFont(QFont("Courier"));
    }
}
开发者ID:mcu786,项目名称:my_OpenPilot_mods,代码行数:50,代码来源:gpsconstellationwidget.cpp

示例5: mBottomMargin

UBTGAdaptableText::UBTGAdaptableText(QTreeWidgetItem* widget, QWidget* parent, const char* name):QTextEdit(parent)
  , mBottomMargin(5)
  , mpTreeWidgetItem(widget)
  , mMinimumHeight(0)
  , mHasPlaceHolder(false)
  , mIsUpdatingSize(false)
  , mMaximumLength(0)
{
    setObjectName(name);
    connect(this,SIGNAL(textChanged()),this,SLOT(onTextChanged()));
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    mMinimumHeight = document()->size().height() + mBottomMargin;
    setMinimumHeight(mMinimumHeight);

}
开发者ID:Sankore,项目名称:Sankore-Plugins,代码行数:17,代码来源:UBTGAdaptableText.cpp

示例6: QTreeWidget

NTrashTree::NTrashTree(QWidget *parent) :
    QTreeWidget(parent)
{
    this->count = 0;
    QFont f = this->font();
    f.setPointSize(8);
    this->setFont(f);

    filterPosition = -1;
    // setup options
    this->setEditTriggers(QAbstractItemView::NoEditTriggers);
    this->setSelectionBehavior(QAbstractItemView::SelectRows);
    this->setSelectionMode(QAbstractItemView::ExtendedSelection);
    this->setRootIsDecorated(true);
    this->setSortingEnabled(false);
    this->header()->setVisible(false);
    this->setContentsMargins(10,10,10,10);
    //this->setStyleSheet("QTreeWidget {  border: none; background-color:transparent; }");

    // Build the root item
    QIcon icon(":trash.png");
    root = new QTreeWidgetItem(this);
    root->setIcon(0,icon);
    root->setData(0, Qt::UserRole, "root");
    root->setData(0, Qt::DisplayRole, tr("Trash"));
    QFont font = root->font(0);
    font.setBold(true);
    root->setFont(0,font);
    this->setMinimumHeight(1);
    this->addTopLevelItem(root);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(calculateHeight()));
    connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(calculateHeight()));
    connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(buildSelection()));

    restoreAction = contextMenu.addAction(tr("Restore Deleted Notes"));
    connect(restoreAction, SIGNAL(triggered()), SLOT(restoreAll()));
    contextMenu.addSeparator();
    expungeAction = contextMenu.addAction(tr("Empty Trash"));
    connect(expungeAction, SIGNAL(triggered()), this, SLOT(expungeAll()));

    setItemDelegate(new NTrashViewDelegate());
    this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    this->setFrameShape(QFrame::NoFrame);
}
开发者ID:Hexcles,项目名称:Nixnote2,代码行数:46,代码来源:ntrashtree.cpp

示例7: QGraphicsView

FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent)
{
    setScene(&m_scene);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    setupScene();

    m_animation = new QPropertyAnimation(m_effect, "strength", this);
    m_animation->setDuration(500);
    m_animation->setEasingCurve(QEasingCurve::InOutSine);
    m_animation->setStartValue(0);
    m_animation->setEndValue(1);

    setRenderHint(QPainter::Antialiasing, true);
    setFrameStyle(QFrame::NoFrame);
}
开发者ID:BGmot,项目名称:Qt,代码行数:17,代码来源:fademessage.cpp

示例8: QsciScintilla

QgsCodeEditor::QgsCodeEditor( QWidget *parent, const QString& title, bool folding, bool margin )
    : QsciScintilla( parent )
    , mWidgetTitle( title )
    , mFolding( folding )
    , mMargin( margin )
{
  if ( !parent && mWidgetTitle.isEmpty() )
  {
    setWindowTitle( QStringLiteral( "Text Editor" ) );
  }
  else
  {
    setWindowTitle( mWidgetTitle );
  }
  setSciWidget();
  setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:17,代码来源:qgscodeeditor.cpp

示例9: QGraphicsView

Game::Game(): QGraphicsView(){
    //create a scene
    scene = new QGraphicsScene(this);
    scene->setSceneRect(0,0,800,600);

    //set the scene
    setScene(scene);

    //alter window
    setFixedSize(800,600);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    //make an enemy
    enemy * enemy1 = new enemy();
    scene->addItem(enemy1);
}
开发者ID:ushalin,项目名称:TowerDefence,代码行数:17,代码来源:game.cpp

示例10: QTextEdit

ContactListEdit::ContactListEdit(QWidget* parent)
  : QTextEdit(parent)
  {
  _completer = nullptr;
  _clicked_contact = new bts::addressbook::wallet_contact();

  connect(this, &QTextEdit::textChanged, this, &ContactListEdit::fitHeightToDocument);

  setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
  fitHeightToDocument();

  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

  setTabChangesFocus(true);
  }
开发者ID:toby82,项目名称:keyhotee,代码行数:17,代码来源:ContactListEdit.cpp

示例11: QScrollArea

Panner::Panner( QWidget* parent, const char* /* name */ )
    : QScrollArea( parent ),
      d(new Private())
{
    KGlobal::locale()->insertCatalog("libkicker");

    setWidgetResizable( true );
    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );

    // layout
    d->layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
    d->layout->addWidget(viewport(), 1);
    d->layout->setMargin(0);

    setOrientation(Qt::Horizontal);
}
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:17,代码来源:panner.cpp

示例12: QScrollArea

RecordFilterWidget::RecordFilterWidget(QWidget * parent)
: QScrollArea(parent)
, mRowFilterScheduled(false)
{
    setMaximumHeight(20);

    widget = new QWidget(this);
    layout = new QGridLayout(widget);
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);

    setWidget(widget);
    setWidgetResizable(true);
    setFrameShape(QFrame::NoFrame);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
开发者ID:EntityFXCode,项目名称:arsenalsuite,代码行数:17,代码来源:recordfilterwidget.cpp

示例13: KTextEdit

KItemListRoleEditor::KItemListRoleEditor(QWidget *parent) :
    KTextEdit(parent),
    m_role(),
    m_blockFinishedSignal(false)
{
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setAcceptRichText(false);
    enableFindReplace(false);
    document()->setDocumentMargin(0);

    if (parent) {
        parent->installEventFilter(this);
    }

    connect(this, &KItemListRoleEditor::textChanged, this, &KItemListRoleEditor::autoAdjustSize);
}
开发者ID:hagerhaf,项目名称:dolphin,代码行数:17,代码来源:kitemlistroleeditor.cpp

示例14: QGraphicsView

SingleView::SingleView(Plasma::Corona *corona, Plasma::Containment *containment, const QString &pluginName, int appletId, const QVariantList &appletArgs, QWidget *parent)
    : QGraphicsView(parent),
      m_applet(0),
      m_containment(containment),
      m_corona(corona)
{
    setScene(m_corona);
    QFileInfo info(pluginName);
    if (!info.isAbsolute()) {
        info = QFileInfo(QDir::currentPath() + '/' + pluginName);
    }

    if (info.exists()) {
        m_applet = Plasma::Applet::loadPlasmoid(info.absoluteFilePath(), appletId, appletArgs);
    }

    if (!m_applet) {
        m_applet = Plasma::Applet::load(pluginName, appletId, appletArgs);
    }

    if (!m_applet) {
        kDebug() << "failed to load" << pluginName;
        return;
    }

    m_containment->addApplet(m_applet, QPointF(-1, -1), false);
    m_containment->resize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);

    m_applet->setPos(0, 0);
    m_applet->setFlag(QGraphicsItem::ItemIsMovable, false);
    setSceneRect(m_applet->sceneBoundingRect());
    setWindowTitle(m_applet->name());
    setWindowIcon(SmallIcon(m_applet->icon()));
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setFrameStyle(QFrame::NoFrame);

    QAction *action = m_applet->action("remove");
    delete action;

    QAction *quitAction = KStandardAction::quit(this, SLOT(close()), this);
    m_applet->addAction(QString("remove"), quitAction);
    addAction(quitAction);
    // enforce the applet being our size
    connect(m_applet, SIGNAL(geometryChanged()), this, SLOT(updateGeometry()));
}
开发者ID:walac,项目名称:kde-workspace,代码行数:46,代码来源:singleview.cpp

示例15: app_

AppView::AppView(App& app)
    : app_(app),
      toolbar_(*this),
      visibleAreaMode_(0),
      lineMode_(scene_),
      arrowMode_(scene_),
      rectMode_(scene_),
      currentMode_(visibleAreaMode_) {

    setFrameShape(QFrame::NoFrame);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

    reinitVisibleArea();
    setScene(&scene_);
}
开发者ID:dsimakov,项目名称:screenshotgun,代码行数:17,代码来源:AppView.cpp


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