Esempio n. 1
0
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*)));
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
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
	);
}
/*
 * 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"));
    }
}
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);

}
Esempio n. 6
0
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);
}
Esempio n. 7
0
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);
}
Esempio n. 8
0
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 );
}
Esempio n. 9
0
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);
}
Esempio n. 10
0
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);
  }
Esempio n. 11
0
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);
}
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);
}
Esempio n. 13
0
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);
}
Esempio n. 14
0
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()));
}
Esempio n. 15
0
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_);
}
Esempio n. 16
0
WordView::WordView(QWidget *parent)
	: QTextEdit(parent)
{
	m_shownSolutions = 16;
	m_shownClues = 30;
	m_tablePadding = 0;
	m_tableSpacing = 0;

	setReadOnly(true);

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

	// TODO(jasonkb) background/foreground colors
	//setPaper(QBrush(QColor(LetterboxSettings::self()->backgroundColor)));
	//setColor(LetterboxSettings::self()->foregroundColor);
}
Esempio n. 17
0
MyQGraphicsView::MyQGraphicsView(QGraphicsScene* scene, QWidget* parent)
 : QGraphicsView(scene, parent)
{
    setAlignment(Qt::AlignLeft | Qt::AlignTop);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    mLayout = new QGraphicsGridLayout;

    mTitle = new MyTextWidget("title");
    mLayout->addItem(mTitle, 0, 0, 1, 2);
    mLayout->setRowMaximumHeight(0, 20);

    mLocation = new MyTextWidget("location");
    mLayout->addItem(mLocation, 1, 0, 1, 2);
    mLayout->setRowMaximumHeight(1, 20);

    mForm = new QGraphicsWidget;
    mForm->setLayout(mLayout);
    scene->addItem(mForm);

    mozView = new QMozView(mForm);
    mLayout->addItem(mozView, 2, 0, 1, 2);

    mStatus = new MyTextWidget("status");
    mLayout->addItem(mStatus, 3, 0);
    mLayout->setRowMaximumHeight(3, 20);

    QWidget* exitButton = new QPushButton("Exit");
    mLayout->addItem(scene->addWidget(exitButton), 3, 1);
    mLayout->setColumnMaximumWidth(1, 50);

    connect(mozView, SIGNAL(locationChanged(const QString&)),
            mLocation, SLOT(setText(const QString&)));

    connect(mozView, SIGNAL(titleChanged(const QString&)),
            mTitle, SLOT(setText(const QString&)));

    connect(mozView, SIGNAL(statusChanged(const QString&)),
            mStatus, SLOT(setText(const QString&)));

    connect(mozView, SIGNAL(consoleMessage(const QString&)),
            this, SLOT(consoleMessage(const QString&)));

    connect(exitButton, SIGNAL(clicked()), this, SLOT(close()));
}
Esempio n. 18
0
TimelineBar::TimelineBar(ICaptureContext &ctx, QWidget *parent)
    : QAbstractScrollArea(parent), m_Ctx(ctx)
{
  m_Ctx.AddCaptureViewer(this);

  setMouseTracking(true);

  setFrameShape(NoFrame);

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

  QObject::connect(horizontalScrollBar(), &QScrollBar::valueChanged,
                   [this](int value) { m_pan = -value; });

  setWindowTitle(tr("Timeline"));
}
Esempio n. 19
0
GraphicsView::
        GraphicsView(QGraphicsScene* scene)
    :   QGraphicsView(scene)
//        ,pressed_control_(false)
{
    EXCEPTION_ASSERT(scene);

    setWindowTitle(tr("Sonic AWE"));
    //setRenderHints(QPainter::SmoothPixmapTransform);
    //setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing);
    setMouseTracking( true );

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


    setRenderHints(renderHints() | QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

    setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
    // Caching slows down rendering of animated frames.
    setCacheMode(QGraphicsView::CacheNone);

    tool_proxy_ = new QGraphicsProxyWidget;
    layout_widget_ = new QWidget;

    // Make all child widgets occupy the entire area
    layout_widget_->setLayout(new QBoxLayout(QBoxLayout::TopToBottom));
    layout_widget_->layout()->setMargin(0);
    layout_widget_->layout()->setSpacing(0);

    tool_proxy_->setWidget( layout_widget_ );
    tool_proxy_->setWindowFlags( Qt::FramelessWindowHint );

    setToolFocus( false );

    // would prefer WA_NoBackground to hide the background, but some cache (which we're not using) isn't cleared while resizing without more work. Setting alpha to 0 also works
    //layout_widget_->setAttribute(Qt::WA_NoBackground);
    layout_widget_->setPalette(QPalette(QPalette::Window, QColor(0,0,0,0)));

    scene->addItem( tool_proxy_  );
    tool_proxy_->setParent( scene );

    setAcceptDrops(true);
}
Esempio n. 20
0
MainGraphicsView::MainGraphicsView(QWidget * parent)
	: QGraphicsView(parent)
	, m_canZoom(true)
	, m_zoomChanging(false)
{
	setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
	setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform );
	setCacheMode(QGraphicsView::CacheBackground);
	setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
	setOptimizationFlags(QGraphicsView::DontSavePainterState);
	setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
	setTransformationAnchor(AnchorUnderMouse);
	setResizeAnchor(AnchorViewCenter);
	setBackgroundBrush(Qt::lightGray);
	setDragMode(QGraphicsView::ScrollHandDrag);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
Esempio n. 21
0
        TabsTreeView( QWidget *parent = 0 )
            : Amarok::PrettyTreeView( parent )
        {
            setAttribute( Qt::WA_NoSystemBackground );
            viewport()->setAutoFillBackground( false );

            setHeaderHidden( true );
            setIconSize( QSize( 36, 36 ) );
            setDragDropMode( QAbstractItemView::DragOnly );
            setSelectionMode( QAbstractItemView::SingleSelection );
            setSelectionBehavior( QAbstractItemView::SelectItems );
            setAnimated( true );
            setRootIsDecorated( false );
            setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
            setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
            setFixedWidth( 48 );

        }
Esempio n. 22
0
/* ContactBrowser */
ContactBrowser::ContactBrowser( QWidget *parent, const char * objectName)
    : QDLBrowserClient( parent, "contactnotes" )
{
    setObjectName(objectName);

    setFrameStyle(NoFrame);
    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);

    connect(this, SIGNAL(highlighted(QString)),
            this, SLOT(linkHighlighted(QString)));

    QSoftMenuBar::setLabel(this, Qt::Key_Back,
        QSoftMenuBar::Back, QSoftMenuBar::AnyFocus);
    QSoftMenuBar::setLabel(this, Qt::Key_Select,
        QSoftMenuBar::NoLabel, QSoftMenuBar::AnyFocus);
    mDocument = NULL;
}
Esempio n. 23
0
/**
* Constructs a QFilterView with the given @p parent.
*/
QFilterView::QFilterView( QWidget* parent )
    : QTableView(parent), d(new QFilterViewPrivate(this))
{
    setItemDelegate(new QFilterViewItemDelegate(this));

    setHorizontalHeader(new QAdvancedHeaderView(Qt::Horizontal, this));
    setVerticalHeader(new QAdvancedHeaderView(Qt::Vertical, this));

    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QAbstractButton* cb = findChild<QAbstractButton*>();
    if (cb){
        cb->disconnect();
        connect(cb, SIGNAL(clicked()), this, SIGNAL(cornerButtonClicked()));
    }
    updateGeometry();

}
Esempio n. 24
0
/**
 * This function creates a new scene for the game to take place in
 * @brief RoundOne::RoundOne constructor creates a new QGraphicsScene, sets its Pixmap and sets its size
 * @param parent of RoundOne is QGraphics View
 */
RoundOne::RoundOne(QWidget *parent):QGraphicsView(parent)
{

    ///create new QGraphicsScene
    scene_one= new QGraphicsScene();
    ///set the size of the scene
    scene_one-> setSceneRect(0,0,800,600);
    ///set the background
    setBackgroundBrush(QBrush(QImage(":/new/prefix1/DragonEnclosure.png").scaledToHeight(600)));

    ///set the scene
    setScene(scene_one);
    ///turn off vertical and horizontal scroll bars
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    ///set size of the scene
    setFixedSize(800, 600);
}
Esempio n. 25
0
void MainWindow::setupWidget()
{
    QRect screenRect = QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen());
    QRect windowRect(0, 0, 800, 600);
    if (screenRect.width() < 800)
        windowRect.setWidth(screenRect.width());
    if (screenRect.height() < 600)
        windowRect.setHeight(screenRect.height());
    windowRect.moveCenter(screenRect.center());
    this->setGeometry(windowRect);
    this->setMinimumSize(80, 60);
    setWindowTitle(tr("Qt Examples and Demos"));
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setFrameStyle(QFrame::NoFrame);
    this->setRenderingSystem();
    connect(&this->updateTimer, SIGNAL(timeout()), this, SLOT(tick()));
}
Esempio n. 26
0
WebView::WebView ( QGraphicsScene *scene, QWidget *parent ) : QGraphicsView(scene, parent), d(new Private)
{
    //      setWindowFlags(Qt::FramelessWindowHint);
//        setAttribute(Qt::WA_ContentsPropagated );
//        setViewport(new QGLWidget(QGLFormat(QGL::DirectRendering | QGL::SampleBuffers)));
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    setFrameStyle(QFrame::NoFrame);
    setAlignment(Qt::AlignLeft | Qt::AlignTop);
    setCacheMode(QGraphicsView::CacheBackground);
    d->coverflow = new PictureFlow(this);
    d->coverflow->resize(800, 480);
    d->coverflow->hide();
    // d->coverflow->setBackgroundColor(Qt::white);

    d->reflect = QPixmap();
}
Esempio n. 27
0
InboxButtonView::InboxButtonView(QWidget* parent)
        : QGraphicsView(parent), m_usedWidth(0)
{
    setMinimumHeight( 24 );
    setMaximumHeight( minimumHeight() );

    setFrameShape(QFrame::NoFrame);
    setFrameShadow(QFrame::Plain);
    setLineWidth(0);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setInteractive(true);
    setAttribute(Qt::WA_Hover, true);
    setAlignment(Qt::AlignLeft | Qt::AlignTop);

    m_scene = new QGraphicsScene(this);
    setScene( m_scene );
}
Esempio n. 28
0
BoardView::BoardView(QGraphicsScene* scene, QWidget* parent)
	: QGraphicsView(scene, parent),
	  m_initialized(false),
	  m_resizeTimer(new QTimer(this))
{
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setRenderHint(QPainter::Antialiasing);
	setMouseTracking(true);

	m_resizeTimer->setSingleShot(true);
	m_resizeTimer->setInterval(300);

	connect(m_resizeTimer, SIGNAL(timeout()),
		this, SLOT(fitToRect()));
	connect(scene, SIGNAL(sceneRectChanged(QRectF)),
		this, SLOT(fitToRect()));
}
Esempio n. 29
0
TextEdit::TextEdit(const QString & str, QWidget *parent) : QTextEdit(parent)
{
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    //setFrameShape(QFrame::NoFrame);
    setFrameShadow(QFrame::Plain);
    setLineWrapMode(QTextEdit::NoWrap);
    setAcceptRichText(false);
    setAutoFormatting(QTextEdit::AutoNone);
    setTabChangesFocus(true);
    setPlainText(str);
    CalcSize();
    connect( this, SIGNAL( textChanged() ), this, SLOT( sltTextChanged() ) );

    QTextCursor cursor = this->textCursor();
    cursor.select(QTextCursor::LineUnderCursor);
    setTextCursor( cursor );
}
Esempio n. 30
0
        AlbumsTreeView( QWidget *parent = 0 )
            : Amarok::PrettyTreeView( parent )
        {
            setAttribute( Qt::WA_NoSystemBackground );
            viewport()->setAutoFillBackground( false );

            setHeaderHidden( true );
            setIconSize( QSize(60,60) );
            setDragDropMode( QAbstractItemView::DragOnly );
            setSelectionMode( QAbstractItemView::ExtendedSelection );
            setSelectionBehavior( QAbstractItemView::SelectItems );
            //setAnimated( true ); // looks TERRIBLE
            
            setRootIsDecorated( false );

            setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
            setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); // Scrolling per item is really not smooth and looks terrible
        }