Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
splitter.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtGui>
5
6#include "splitter.h"
7
9 : QSplitterHandle(orientation, parent)
10{
11 gradient.setColorAt(0.0, Qt::darkGreen);
12 gradient.setColorAt(0.25, Qt::white);
13 gradient.setColorAt(1.0, Qt::darkGreen);
14}
15
18{
19 QPainter painter(this);
20 if (orientation() == Qt::Horizontal) {
21 gradient.setStart(rect().left(), rect().height()/2);
22 gradient.setFinalStop(rect().right(), rect().height()/2);
23 } else {
24 gradient.setStart(rect().width()/2, rect().top());
25 gradient.setFinalStop(rect().width()/2, rect().bottom());
26 }
27 painter.fillRect(event->rect(), QBrush(gradient));
28}
30
32 : QSplitter(orientation, parent)
33{
34}
35
\inmodule QtGui
Definition qbrush.h:30
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
Definition qbrush.cpp:1563
void setFinalStop(const QPointF &stop)
Definition qbrush.cpp:1943
void setStart(const QPointF &start)
Definition qbrush.cpp:1902
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
The QSplitterHandle class provides handle functionality for the splitter.
Definition qsplitter.h:98
Qt::Orientation orientation() const
Returns the handle's orientation.
The QSplitter class implements a splitter widget.
Definition qsplitter.h:21
Qt::Orientation orientation
the orientation of the splitter
Definition qsplitter.h:24
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
int width
the width of the widget excluding any window frame
Definition qwidget.h:114
int height
the height of the widget excluding any window frame
Definition qwidget.h:115
QRect rect
the internal geometry of the widget excluding any window frame
Definition qwidget.h:116
SplitterHandle(Qt::Orientation orientation, QSplitter *parent)
Definition splitter.cpp:8
void paintEvent(QPaintEvent *event) override
[0]
Definition splitter.cpp:17
Splitter(Qt::Orientation orientation, QWidget *parent=nullptr)
[0]
Definition splitter.cpp:31
QSplitterHandle * createHandle() override
[1]
Definition splitter.cpp:37
Orientation
Definition qnamespace.h:98
@ Horizontal
Definition qnamespace.h:99
@ white
Definition qnamespace.h:31
@ darkGreen
Definition qnamespace.h:42
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble right
GLint left
GLint GLint bottom
struct _cl_event * event
QPainter painter(this)
[7]