Cleanup Widgets examples - nullptr
Cleanup the widgets examples - replace 0 with nullptr Change-Id: Id4bf119b9a41f6d10117f3a613a6e604128fa196 Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
parent
c590aa678d
commit
aa32510430
@ -69,7 +69,7 @@ class Button : public QGraphicsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Button(const QPixmap &pixmap, QGraphicsItem *parent = 0)
|
||||
Button(const QPixmap &pixmap, QGraphicsItem *parent = nullptr)
|
||||
: QGraphicsWidget(parent), _pix(pixmap)
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
class Window : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Window(QWidget *parent = 0);
|
||||
Window(QWidget *parent = nullptr);
|
||||
private slots:
|
||||
void curveChanged(int row);
|
||||
void pathChanged(int index);
|
||||
|
@ -169,7 +169,8 @@ class GraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GraphicsView(QGraphicsScene *scene, QWidget *parent = NULL) : QGraphicsView(scene, parent)
|
||||
GraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr)
|
||||
: QGraphicsView(scene, parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,9 @@
|
||||
#include <QtWidgets/QGraphicsScene>
|
||||
#include <QtWidgets/QGraphicsView>
|
||||
|
||||
GraphicsView::GraphicsView(QWidget *parent) : QGraphicsView(parent), m_editor(0) {}
|
||||
GraphicsView::GraphicsView(QWidget *parent)
|
||||
: QGraphicsView(parent), m_editor(nullptr)
|
||||
{}
|
||||
|
||||
void GraphicsView::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ class GraphicsView: public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GraphicsView(QWidget *parent = 0);
|
||||
GraphicsView(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
@ -175,9 +175,8 @@ void LifeCycle::addActivity(const QString &fileName, Qt::Key key, QObject *sende
|
||||
QState *state = makeState(m_alive, fileName);
|
||||
m_alive->addTransition(new KeyPressTransition(m_keyReceiver, key, state));
|
||||
|
||||
if((sender != NULL) || (signal != NULL)) {
|
||||
if (sender || signal)
|
||||
m_alive->addTransition(sender, signal, state);
|
||||
}
|
||||
}
|
||||
|
||||
QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName)
|
||||
@ -192,7 +191,7 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa
|
||||
}
|
||||
|
||||
const int frameCount = animation.totalFrames();
|
||||
QState *previousState = 0;
|
||||
QState *previousState = nullptr;
|
||||
for (int i=0; i<frameCount; ++i) {
|
||||
animation.setCurrentFrame(i);
|
||||
|
||||
@ -204,7 +203,7 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa
|
||||
//! [1]
|
||||
|
||||
frameState->setObjectName(QString::fromLatin1("frame %0").arg(i));
|
||||
if (previousState == 0)
|
||||
if (previousState == nullptr)
|
||||
topLevel->setInitialState(frameState);
|
||||
else
|
||||
//! [2]
|
||||
|
@ -176,8 +176,7 @@ Node *StickMan::node(int idx) const
|
||||
{
|
||||
if (idx >= 0 && idx < NodeCount)
|
||||
return m_nodes[idx];
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void StickMan::timerEvent(QTimerEvent *)
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
// the universe's only animation manager
|
||||
AnimationManager *AnimationManager::instance = 0;
|
||||
AnimationManager *AnimationManager::instance = nullptr;
|
||||
|
||||
AnimationManager::AnimationManager()
|
||||
{
|
||||
|
@ -92,8 +92,9 @@ static QAbstractAnimation *setupDestroyAnimation(Boat *boat)
|
||||
|
||||
|
||||
|
||||
Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big),
|
||||
speed(0), bombsAlreadyLaunched(0), direction(Boat::None), movementAnimation(0)
|
||||
Boat::Boat()
|
||||
: PixmapItem(QString("boat"), GraphicsScene::Big),
|
||||
speed(0), bombsAlreadyLaunched(0), direction(Boat::None)
|
||||
{
|
||||
setZValue(4);
|
||||
setFlags(QGraphicsItem::ItemIsFocusable);
|
||||
|
@ -146,7 +146,8 @@ private:
|
||||
class MoveStateRight : public QState
|
||||
{
|
||||
public:
|
||||
explicit MoveStateRight(Boat *boat,QState *parent = 0) : QState(parent), boat(boat)
|
||||
explicit MoveStateRight(Boat *boat, QState *parent = nullptr)
|
||||
: QState(parent), boat(boat)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
@ -163,7 +164,8 @@ private:
|
||||
class MoveStateLeft : public QState
|
||||
{
|
||||
public:
|
||||
explicit MoveStateLeft(Boat *boat,QState *parent = 0) : QState(parent), boat(boat)
|
||||
explicit MoveStateLeft(Boat *boat, QState *parent = nullptr)
|
||||
: QState(parent), boat(boat)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
@ -180,7 +182,8 @@ private:
|
||||
class StopState : public QState
|
||||
{
|
||||
public:
|
||||
explicit StopState(Boat *boat,QState *parent = 0) : QState(parent), boat(boat)
|
||||
explicit StopState(Boat *boat, QState *parent = nullptr)
|
||||
: QState(parent), boat(boat)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
@ -198,13 +201,14 @@ private:
|
||||
class LaunchStateRight : public QState
|
||||
{
|
||||
public:
|
||||
explicit LaunchStateRight(Boat *boat,QState *parent = 0) : QState(parent), boat(boat)
|
||||
explicit LaunchStateRight(Boat *boat, QState *parent = nullptr)
|
||||
: QState(parent), boat(boat)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void onEntry(QEvent *) override
|
||||
{
|
||||
Bomb *b = new Bomb();
|
||||
Bomb *b = new Bomb;
|
||||
b->setPos(boat->x()+boat->size().width(),boat->y());
|
||||
GraphicsScene *scene = static_cast<GraphicsScene *>(boat->scene());
|
||||
scene->addItem(b);
|
||||
@ -219,13 +223,14 @@ private:
|
||||
class LaunchStateLeft : public QState
|
||||
{
|
||||
public:
|
||||
explicit LaunchStateLeft(Boat *boat,QState *parent = 0) : QState(parent), boat(boat)
|
||||
explicit LaunchStateLeft(Boat *boat, QState *parent = nullptr)
|
||||
: QState(parent), boat(boat)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
void onEntry(QEvent *) override
|
||||
{
|
||||
Bomb *b = new Bomb();
|
||||
Bomb *b = new Bomb;
|
||||
b->setPos(boat->x() - b->size().width(), boat->y());
|
||||
GraphicsScene *scene = static_cast<GraphicsScene *>(boat->scene());
|
||||
scene->addItem(b);
|
||||
|
@ -63,7 +63,8 @@
|
||||
# include <QtOpenGL/QtOpenGL>
|
||||
#endif
|
||||
|
||||
MainWindow::MainWindow() : QMainWindow(0)
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
QMenu *file = menuBar()->addMenu(tr("&File"));
|
||||
|
||||
|
@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow();
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
GraphicsScene *scene;
|
||||
|
@ -54,7 +54,8 @@
|
||||
//Qt
|
||||
#include <QPainter>
|
||||
|
||||
PixmapItem::PixmapItem(const QString &fileName,GraphicsScene::Mode mode, QGraphicsItem * parent) : QGraphicsObject(parent)
|
||||
PixmapItem::PixmapItem(const QString &fileName,GraphicsScene::Mode mode, QGraphicsItem * parent)
|
||||
: QGraphicsObject(parent)
|
||||
{
|
||||
if (mode == GraphicsScene::Big)
|
||||
pix = QPixmap(QStringLiteral(":/big/") + fileName);
|
||||
|
@ -60,7 +60,7 @@
|
||||
class PixmapItem : public QGraphicsObject
|
||||
{
|
||||
public:
|
||||
PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0);
|
||||
PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem *parent = nullptr);
|
||||
PixmapItem(const QString &fileName, QGraphicsScene *scene);
|
||||
QSizeF size() const;
|
||||
QRectF boundingRect() const override;
|
||||
|
@ -84,7 +84,7 @@ machine.start();
|
||||
Constructs a new state with the given \a parent state.
|
||||
*/
|
||||
QAnimationState::QAnimationState(QState *parent)
|
||||
: QState(parent), m_animation(0)
|
||||
: QState(parent), m_animation(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -67,11 +67,8 @@
|
||||
#include <QtCore/QRandomGenerator>
|
||||
|
||||
PlayState::PlayState(GraphicsScene *scene, QState *parent)
|
||||
: QState(parent),
|
||||
scene(scene),
|
||||
machine(0),
|
||||
currentLevel(0),
|
||||
score(0)
|
||||
: QState(parent), scene(scene), machine(nullptr),
|
||||
currentLevel(0), score(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ int main(int argc, char *argv[])
|
||||
QApplication app(argc, argv);
|
||||
|
||||
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
QMessageBox::critical(0, QObject::tr("Systray"),
|
||||
QMessageBox::critical(nullptr, QObject::tr("Systray"),
|
||||
QObject::tr("I couldn't detect any system tray "
|
||||
"on this system."));
|
||||
return 1;
|
||||
|
@ -176,7 +176,7 @@ void Window::showMessage()
|
||||
//! [6]
|
||||
void Window::messageClicked()
|
||||
{
|
||||
QMessageBox::information(0, tr("Systray"),
|
||||
QMessageBox::information(nullptr, tr("Systray"),
|
||||
tr("Sorry, I already gave what help I could.\n"
|
||||
"Maybe you should try asking a human?"));
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void ClassWizard::accept()
|
||||
|
||||
QFile headerFile(outputDir + '/' + header);
|
||||
if (!headerFile.open(QFile::WriteOnly | QFile::Text)) {
|
||||
QMessageBox::warning(0, QObject::tr("Simple Wizard"),
|
||||
QMessageBox::warning(nullptr, QObject::tr("Simple Wizard"),
|
||||
QObject::tr("Cannot write file %1:\n%2")
|
||||
.arg(headerFile.fileName())
|
||||
.arg(headerFile.errorString()));
|
||||
@ -195,7 +195,7 @@ void ClassWizard::accept()
|
||||
|
||||
QFile implementationFile(outputDir + '/' + implementation);
|
||||
if (!implementationFile.open(QFile::WriteOnly | QFile::Text)) {
|
||||
QMessageBox::warning(0, QObject::tr("Simple Wizard"),
|
||||
QMessageBox::warning(nullptr, QObject::tr("Simple Wizard"),
|
||||
QObject::tr("Cannot write file %1:\n%2")
|
||||
.arg(implementationFile.fileName())
|
||||
.arg(implementationFile.errorString()));
|
||||
|
@ -182,7 +182,7 @@ QStringList Window::findFiles(const QStringList &files, const QString &text)
|
||||
|
||||
for (int i = 0; i < files.size(); ++i) {
|
||||
progressDialog.setValue(i);
|
||||
progressDialog.setLabelText(tr("Searching file number %1 of %n...", 0, files.size()).arg(i));
|
||||
progressDialog.setLabelText(tr("Searching file number %1 of %n...", nullptr, files.size()).arg(i));
|
||||
QCoreApplication::processEvents();
|
||||
//! [6]
|
||||
|
||||
@ -237,7 +237,7 @@ void Window::showFiles(const QStringList &paths)
|
||||
filesTable->setItem(row, 0, fileNameItem);
|
||||
filesTable->setItem(row, 1, sizeItem);
|
||||
}
|
||||
filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", 0, paths.size()));
|
||||
filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", nullptr, paths.size()));
|
||||
filesFoundLabel->setWordWrap(true);
|
||||
}
|
||||
//! [8]
|
||||
|
@ -65,7 +65,7 @@
|
||||
class DialogOptionsWidget : public QGroupBox
|
||||
{
|
||||
public:
|
||||
explicit DialogOptionsWidget(QWidget *parent = 0);
|
||||
explicit DialogOptionsWidget(QWidget *parent = nullptr);
|
||||
|
||||
void addCheckBox(const QString &text, int value);
|
||||
void addSpacer();
|
||||
@ -492,7 +492,7 @@ void Dialog::questionMessage()
|
||||
void Dialog::warningMessage()
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Warning, tr("QMessageBox::warning()"),
|
||||
MESSAGE, 0, this);
|
||||
MESSAGE, nullptr, this);
|
||||
msgBox.setDetailedText(MESSAGE_DETAILS);
|
||||
msgBox.addButton(tr("Save &Again"), QMessageBox::AcceptRole);
|
||||
msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include <QGraphicsScene>
|
||||
|
||||
CustomProxy::CustomProxy(QGraphicsItem *parent, Qt::WindowFlags wFlags)
|
||||
: QGraphicsProxyWidget(parent, wFlags), popupShown(false), currentPopup(0)
|
||||
: QGraphicsProxyWidget(parent, wFlags), popupShown(false), currentPopup(nullptr)
|
||||
{
|
||||
timeLine = new QTimeLine(250, this);
|
||||
connect(timeLine, &QTimeLine::valueChanged,
|
||||
@ -133,7 +133,7 @@ QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &valu
|
||||
currentPopup->installSceneEventFilter(this);
|
||||
} else if (scene()) {
|
||||
currentPopup->removeSceneEventFilter(this);
|
||||
currentPopup = 0;
|
||||
currentPopup = nullptr;
|
||||
}
|
||||
} else if (currentPopup && change == ItemSceneHasChanged) {
|
||||
currentPopup->installSceneEventFilter(this);
|
||||
|
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (int y = 0; y < gridSize; ++y) {
|
||||
for (int x = 0; x < gridSize; ++x) {
|
||||
CustomProxy *proxy = new CustomProxy(0, Qt::Window);
|
||||
CustomProxy *proxy = new CustomProxy(nullptr, Qt::Window);
|
||||
proxy->setWidget(new EmbeddedDialog);
|
||||
|
||||
QRectF rect = proxy->boundingRect();
|
||||
|
@ -98,10 +98,7 @@ int BorderLayout::count() const
|
||||
QLayoutItem *BorderLayout::itemAt(int index) const
|
||||
{
|
||||
ItemWrapper *wrapper = list.value(index);
|
||||
if (wrapper)
|
||||
return wrapper->item;
|
||||
else
|
||||
return 0;
|
||||
return wrapper ? wrapper->item : nullptr;
|
||||
}
|
||||
|
||||
QSize BorderLayout::minimumSize() const
|
||||
@ -111,7 +108,7 @@ QSize BorderLayout::minimumSize() const
|
||||
|
||||
void BorderLayout::setGeometry(const QRect &rect)
|
||||
{
|
||||
ItemWrapper *center = 0;
|
||||
ItemWrapper *center = nullptr;
|
||||
int eastWidth = 0;
|
||||
int westWidth = 0;
|
||||
int northHeight = 0;
|
||||
@ -189,7 +186,7 @@ QLayoutItem *BorderLayout::takeAt(int index)
|
||||
ItemWrapper *layoutStruct = list.takeAt(index);
|
||||
return layoutStruct->item;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BorderLayout::add(QLayoutItem *item, Position position)
|
||||
|
@ -116,8 +116,7 @@ QLayoutItem *FlowLayout::takeAt(int index)
|
||||
{
|
||||
if (index >= 0 && index < itemList.size())
|
||||
return itemList.takeAt(index);
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
//! [5]
|
||||
|
||||
@ -215,7 +214,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
|
||||
return -1;
|
||||
} else if (parent->isWidgetType()) {
|
||||
QWidget *pw = static_cast<QWidget *>(parent);
|
||||
return pw->style()->pixelMetric(pm, 0, pw);
|
||||
return pw->style()->pixelMetric(pm, nullptr, pw);
|
||||
} else {
|
||||
return static_cast<QLayout *>(parent)->spacing();
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ void ColorSwatch::changeVerticalTitleBar(bool on)
|
||||
QSize BlueTitleBar::minimumSizeHint() const
|
||||
{
|
||||
QDockWidget *dw = qobject_cast<QDockWidget*>(parentWidget());
|
||||
Q_ASSERT(dw != 0);
|
||||
Q_ASSERT(dw);
|
||||
QSize result(leftPm.width() + rightPm.width(), centerPm.height());
|
||||
if (dw->features() & QDockWidget::DockWidgetVerticalTitleBar)
|
||||
result.transpose();
|
||||
@ -605,7 +605,7 @@ void BlueTitleBar::paintEvent(QPaintEvent*)
|
||||
QRect rect = this->rect();
|
||||
|
||||
QDockWidget *dw = qobject_cast<QDockWidget*>(parentWidget());
|
||||
Q_ASSERT(dw != 0);
|
||||
Q_ASSERT(dw);
|
||||
|
||||
if (dw->features() & QDockWidget::DockWidgetVerticalTitleBar) {
|
||||
QSize s = rect.size();
|
||||
@ -632,7 +632,7 @@ void BlueTitleBar::mouseReleaseEvent(QMouseEvent *event)
|
||||
QRect rect = this->rect();
|
||||
|
||||
QDockWidget *dw = qobject_cast<QDockWidget*>(parentWidget());
|
||||
Q_ASSERT(dw != 0);
|
||||
Q_ASSERT(dw);
|
||||
|
||||
if (dw->features() & QDockWidget::DockWidgetVerticalTitleBar) {
|
||||
QPoint p = pos;
|
||||
@ -676,7 +676,7 @@ void BlueTitleBar::mouseReleaseEvent(QMouseEvent *event)
|
||||
void BlueTitleBar::updateMask()
|
||||
{
|
||||
QDockWidget *dw = qobject_cast<QDockWidget*>(parent());
|
||||
Q_ASSERT(dw != 0);
|
||||
Q_ASSERT(dw);
|
||||
|
||||
QRect rect = dw->rect();
|
||||
QPixmap bitmap(dw->size());
|
||||
|
@ -208,7 +208,7 @@ ToolBar::ToolBar(const QString &title, QWidget *parent)
|
||||
void ToolBar::updateMenu()
|
||||
{
|
||||
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget());
|
||||
Q_ASSERT(mainWindow != 0);
|
||||
Q_ASSERT(mainWindow);
|
||||
|
||||
const Qt::ToolBarArea area = mainWindow->toolBarArea(this);
|
||||
const Qt::ToolBarAreas areas = allowedAreas();
|
||||
@ -313,7 +313,7 @@ void ToolBar::place(Qt::ToolBarArea area, bool p)
|
||||
return;
|
||||
|
||||
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget());
|
||||
Q_ASSERT(mainWindow != 0);
|
||||
Q_ASSERT(mainWindow);
|
||||
|
||||
mainWindow->addToolBar(area, this);
|
||||
|
||||
@ -355,7 +355,7 @@ void ToolBar::placeBottom(bool p)
|
||||
void ToolBar::insertToolBarBreak()
|
||||
{
|
||||
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget());
|
||||
Q_ASSERT(mainWindow != 0);
|
||||
Q_ASSERT(mainWindow);
|
||||
|
||||
mainWindow->insertToolBarBreak(this);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ void MainWindow::about()
|
||||
|
||||
void MainWindow::updateMenus()
|
||||
{
|
||||
bool hasMdiChild = (activeMdiChild() != 0);
|
||||
bool hasMdiChild = (activeMdiChild() != nullptr);
|
||||
saveAct->setEnabled(hasMdiChild);
|
||||
saveAsAct->setEnabled(hasMdiChild);
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
@ -483,7 +483,7 @@ MdiChild *MainWindow::activeMdiChild() const
|
||||
{
|
||||
if (QMdiSubWindow *activeSubWindow = mdiArea->activeSubWindow())
|
||||
return qobject_cast<MdiChild *>(activeSubWindow->widget());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QMdiSubWindow *MainWindow::findMdiChild(const QString &fileName) const
|
||||
@ -495,7 +495,7 @@ QMdiSubWindow *MainWindow::findMdiChild(const QString &fileName) const
|
||||
if (mdiChild->currentFile() == canonicalFilePath)
|
||||
return window;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::switchLayoutDirection()
|
||||
|
@ -478,5 +478,5 @@ MainWindow *MainWindow::findMainWindow(const QString &fileName) const
|
||||
return mainWin;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class AnalogClock : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AnalogClock(QWidget *parent = 0);
|
||||
AnalogClock(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
@ -59,7 +59,7 @@ class Button : public QToolButton
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Button(const QString &text, QWidget *parent = 0);
|
||||
explicit Button(const QString &text, QWidget *parent = nullptr);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ class Calculator : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Calculator(QWidget *parent = 0);
|
||||
Calculator(QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void digitClicked();
|
||||
|
@ -68,7 +68,7 @@ class CharacterWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CharacterWidget(QWidget *parent = 0);
|
||||
CharacterWidget(QWidget *parent = nullptr);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
public slots:
|
||||
|
@ -188,7 +188,7 @@ void MainWindow::filterChanged(int f)
|
||||
const QFontComboBox::FontFilter filter =
|
||||
filterCombo->itemData(f).value<QFontComboBox::FontFilter>();
|
||||
fontCombo->setFontFilters(filter);
|
||||
statusBar()->showMessage(tr("%n font(s) found", 0, fontCombo->count()));
|
||||
statusBar()->showMessage(tr("%n font(s) found", nullptr, fontCombo->count()));
|
||||
}
|
||||
|
||||
void MainWindow::findSizes(const QFont &font)
|
||||
|
@ -70,7 +70,7 @@ class CodeEditor : public QPlainTextEdit
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CodeEditor(QWidget *parent = 0);
|
||||
CodeEditor(QWidget *parent = nullptr);
|
||||
|
||||
void lineNumberAreaPaintEvent(QPaintEvent *event);
|
||||
int lineNumberAreaWidth();
|
||||
|
@ -59,7 +59,7 @@ class DigitalClock : public QLCDNumber
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DigitalClock(QWidget *parent = 0);
|
||||
DigitalClock(QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void showTime();
|
||||
|
@ -65,7 +65,7 @@ class ElidedLabel : public QFrame
|
||||
Q_PROPERTY(bool isElided READ isElided)
|
||||
|
||||
public:
|
||||
explicit ElidedLabel(const QString &text, QWidget *parent = 0);
|
||||
explicit ElidedLabel(const QString &text, QWidget *parent = nullptr);
|
||||
|
||||
void setText(const QString &text);
|
||||
const QString & text() const { return content; }
|
||||
|
@ -64,7 +64,7 @@ class TestWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TestWidget(QWidget *parent = 0);
|
||||
TestWidget(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
@ -63,7 +63,7 @@ class Window : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Window(QWidget *parent = 0);
|
||||
Window(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
QGroupBox *createFirstExclusiveGroup();
|
||||
|
@ -206,7 +206,7 @@ void Window::validatorChanged(int index)
|
||||
{
|
||||
switch (index) {
|
||||
case 0:
|
||||
validatorLineEdit->setValidator(0);
|
||||
validatorLineEdit->setValidator(nullptr);
|
||||
break;
|
||||
case 1:
|
||||
validatorLineEdit->setValidator(new QIntValidator(
|
||||
|
@ -70,7 +70,7 @@ class MoviePlayer : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MoviePlayer(QWidget *parent = 0);
|
||||
MoviePlayer(QWidget *parent = nullptr);
|
||||
void openFile(const QString &fileName);
|
||||
|
||||
private slots:
|
||||
|
@ -62,7 +62,7 @@ class ScribbleArea : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ScribbleArea(QWidget *parent = 0);
|
||||
ScribbleArea(QWidget *parent = nullptr);
|
||||
|
||||
bool openImage(const QString &fileName);
|
||||
bool saveImage(const QString &fileName, const char *fileFormat);
|
||||
|
@ -59,7 +59,7 @@ class ShapedClock : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ShapedClock(QWidget *parent = 0);
|
||||
ShapedClock(QWidget *parent = nullptr);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
protected:
|
||||
|
@ -66,7 +66,7 @@ class SlidersGroup : public QGroupBox
|
||||
|
||||
public:
|
||||
SlidersGroup(Qt::Orientation orientation, const QString &title,
|
||||
QWidget *parent = 0);
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void valueChanged(int value);
|
||||
|
@ -78,7 +78,7 @@ class WidgetGallery : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WidgetGallery(QWidget *parent = 0);
|
||||
WidgetGallery(QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void changeStyle(const QString &styleName);
|
||||
|
@ -60,7 +60,7 @@ class StyleSheetEditor : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StyleSheetEditor(QWidget *parent = 0);
|
||||
StyleSheetEditor(QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void on_styleCombo_activated(const QString &styleName);
|
||||
|
@ -61,15 +61,14 @@ class TabletApplication : public QApplication
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TabletApplication(int &argv, char **args)
|
||||
: QApplication(argv, args) {}
|
||||
using QApplication::QApplication;
|
||||
|
||||
bool event(QEvent *event) override;
|
||||
void setCanvas(TabletCanvas *canvas)
|
||||
{ m_canvas = canvas; }
|
||||
|
||||
private:
|
||||
TabletCanvas *m_canvas;
|
||||
TabletCanvas *m_canvas = nullptr;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -67,7 +67,7 @@ class TetrixBoard : public QFrame
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TetrixBoard(QWidget *parent = 0);
|
||||
TetrixBoard(QWidget *parent = nullptr);
|
||||
|
||||
void setNextPieceLabel(QLabel *label);
|
||||
QSize sizeHint() const override;
|
||||
|
@ -64,7 +64,7 @@ SortingBox::SortingBox(QWidget *parent)
|
||||
setBackgroundRole(QPalette::Base);
|
||||
//! [2]
|
||||
|
||||
itemInMotion = 0;
|
||||
itemInMotion = nullptr;
|
||||
|
||||
//! [3]
|
||||
newCircleButton = createToolButton(tr("New Circle"),
|
||||
@ -179,7 +179,7 @@ void SortingBox::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton && itemInMotion) {
|
||||
moveItemTo(event->pos());
|
||||
itemInMotion = 0;
|
||||
itemInMotion = nullptr;
|
||||
}
|
||||
}
|
||||
//! [13]
|
||||
|
@ -59,7 +59,7 @@ class LEDWidget : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LEDWidget(QWidget *parent = 0);
|
||||
LEDWidget(QWidget *parent = nullptr);
|
||||
public slots:
|
||||
void flash();
|
||||
|
||||
|
@ -58,7 +58,7 @@ class LocaleSelector : public QComboBox
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LocaleSelector(QWidget *parent = 0);
|
||||
LocaleSelector(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void localeSelected(const QLocale &locale);
|
||||
|
@ -59,7 +59,7 @@ class Dialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dialog(QWidget *parent = 0);
|
||||
explicit Dialog(QWidget *parent = nullptr);
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -60,7 +60,7 @@ class WigglyWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WigglyWidget(QWidget *parent = 0);
|
||||
WigglyWidget(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void setText(const QString &newText) { text = newText; }
|
||||
|
@ -64,7 +64,7 @@ class PreviewWindow : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PreviewWindow(QWidget *parent = 0);
|
||||
PreviewWindow(QWidget *parent = nullptr);
|
||||
|
||||
void setWindowFlags(Qt::WindowFlags flags);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user