Skip to content

Commit

Permalink
Replace Qt keywords with Q_* macros
Browse files Browse the repository at this point in the history
  • Loading branch information
yhgu2000 committed Aug 16, 2023
1 parent d47cedd commit 04a084c
Show file tree
Hide file tree
Showing 20 changed files with 49 additions and 47 deletions.
4 changes: 2 additions & 2 deletions QGoodWindow/Examples/GoodPlayground/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class MainWindow : public QGoodWindow
MainWindow(QWidget *parent = nullptr);
~MainWindow();

public slots:
public Q_SLOTS:
void show();

private slots:
private Q_SLOTS:
void adjustSizeLabel();

private:
Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/Examples/GoodShowCase/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MainWindow : public QGoodWindow
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();

private slots:
private Q_SLOTS:
void themeChange();

private:
Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/Examples/GoodShowCaseGL/glwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GLWidget : public QOpenGLWidget
explicit GLWidget(QWidget *parent = nullptr);
~GLWidget();

public slots:
public Q_SLOTS:
void rotate();

private:
Expand Down
4 changes: 2 additions & 2 deletions QGoodWindow/Examples/GoodShowCaseQML/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class MainWindow : public QGoodWindow
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();

public slots:
public Q_SLOTS:
QString loadPixmapToString(const QString &path);

private slots:
private Q_SLOTS:
QPixmap loadGrayedPixmap(const QPixmap &pix);
QString loadPixmapAsBase64(const QPixmap &pix);
void captionButtonStateChangedPrivate(const QGoodWindow::CaptionButtonState &state);
Expand Down
4 changes: 2 additions & 2 deletions QGoodWindow/QGoodCentralWidget/src/captionbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class CaptionButton : public QWidget
explicit CaptionButton(IconType type, QWidget *parent = nullptr);
~CaptionButton();

signals:
Q_SIGNALS:
void clicked();

public slots:
public Q_SLOTS:
void setIconMode(bool icon_dark);
void setActive(bool is_active);
void setState(int state);
Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/QGoodCentralWidget/src/iconwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class IconWidget : public QWidget
public:
explicit IconWidget(QWidget *parent = nullptr);

public slots:
public Q_SLOTS:
void setPixmap(const QPixmap &pixmap);
void setActive(bool active);

Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/QGoodCentralWidget/src/qgoodcentralwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class QGOODWINDOW_SHARED_EXPORT QGoodCentralWidget : public QWidget
QWidget *right_title_bar_widget = nullptr,
bool title_visible = true, bool icon_visible = true);

public slots:
public Q_SLOTS:
/** Set the title bar and the central widget unified. */
void setUnifiedTitleBarAndCentralWidget(bool unified);

Expand Down
8 changes: 4 additions & 4 deletions QGoodWindow/QGoodCentralWidget/src/titlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,22 +552,22 @@ void TitleBar::captionButtonStateChanged(const QGoodWindow::CaptionButtonState &
// Mouse button clicked
case QGoodWindow::CaptionButtonState::MinimizeClicked:
{
emit m_min_btn->clicked();
Q_EMIT m_min_btn->clicked();

break;
}
case QGoodWindow::CaptionButtonState::MaximizeClicked:
{
if (!m_is_maximized)
emit m_max_btn->clicked();
Q_EMIT m_max_btn->clicked();
else
emit m_restore_btn->clicked();
Q_EMIT m_restore_btn->clicked();

break;
}
case QGoodWindow::CaptionButtonState::CloseClicked:
{
emit m_cls_btn->clicked();
Q_EMIT m_cls_btn->clicked();

break;
}
Expand Down
4 changes: 2 additions & 2 deletions QGoodWindow/QGoodCentralWidget/src/titlebar.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ class TitleBar : public QFrame
public:
explicit TitleBar(QGoodWindow *gw, QWidget *parent = nullptr);

signals:
Q_SIGNALS:
void showMinimized();
void showNormal();
void showMaximized();
void closeWindow();

public slots:
public Q_SLOTS:
void setTitle(const QString &title);
void setIcon(const QPixmap &icon);
void setActive(bool active);
Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/QGoodCentralWidget/src/titlewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TitleWidget : public QWidget
public:
explicit TitleWidget(TitleBar *title_bar, QWidget *parent = nullptr);

public slots:
public Q_SLOTS:
void setText(const QString &text);
void setActive(bool active);
void setTitleAlignment(const Qt::Alignment &alignment);
Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/QGoodWindow/src/qgoodstateholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ void QGoodStateHolder::setCurrentThemeDark(bool dark)
{
m_dark = dark;

emit currentThemeChanged();
Q_EMIT currentThemeChanged();
}
4 changes: 2 additions & 2 deletions QGoodWindow/QGoodWindow/src/qgoodstateholder.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class QGOODWINDOW_SHARED_EXPORT QGoodStateHolder : public QObject
explicit QGoodStateHolder();
~QGoodStateHolder();

signals:
Q_SIGNALS:
void currentThemeChanged();

public slots:
public Q_SLOTS:
bool isCurrentThemeDark() const;
void setCurrentThemeDark(bool dark);

Expand Down
40 changes: 20 additions & 20 deletions QGoodWindow/QGoodWindow/src/qgoodwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ QGoodWindow::QGoodWindow(QWidget *parent, const QColor &clear_color) : QMainWind
if (windowTitle().isEmpty())
{
setWindowTitle(qApp->applicationName());
QTimer::singleShot(0, this, [=]{emit windowTitleChanged(windowTitle());});
QTimer::singleShot(0, this, [=]{Q_EMIT windowTitleChanged(windowTitle());});
}

if (windowIcon().isNull())
{
setWindowIcon(qApp->style()->standardIcon(QStyle::SP_DesktopIcon));
QTimer::singleShot(0, this, [=]{emit windowIconChanged(windowIcon());});
QTimer::singleShot(0, this, [=]{Q_EMIT windowIconChanged(windowIcon());});
}
};
#ifdef Q_OS_WIN
Expand Down Expand Up @@ -544,7 +544,7 @@ void QGoodWindow::themeChanged()
if (m_dark != dark)
{
m_dark = dark;
emit systemThemeChanged();
Q_EMIT systemThemeChanged();
}
#endif
}
Expand Down Expand Up @@ -3022,12 +3022,12 @@ LRESULT QGoodWindow::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
#endif
case WM_SETTEXT:
{
emit gw->windowTitleChanged(gw->windowTitle());
Q_EMIT gw->windowTitleChanged(gw->windowTitle());
break;
}
case WM_SETICON:
{
emit gw->windowIconChanged(gw->windowIcon());
Q_EMIT gw->windowIconChanged(gw->windowIcon());
break;
}
case WM_ENTERSIZEMOVE:
Expand Down Expand Up @@ -4126,19 +4126,19 @@ void QGoodWindow::buttonEnter(qintptr button)
{
case HTMINBUTTON:
{
emit captionButtonStateChanged(CaptionButtonState::MinimizeHoverEnter);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MinimizeHoverEnter);

break;
}
case HTMAXBUTTON:
{
emit captionButtonStateChanged(CaptionButtonState::MaximizeHoverEnter);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MaximizeHoverEnter);

break;
}
case HTCLOSE:
{
emit captionButtonStateChanged(CaptionButtonState::CloseHoverEnter);
Q_EMIT captionButtonStateChanged(CaptionButtonState::CloseHoverEnter);

break;
}
Expand All @@ -4161,19 +4161,19 @@ void QGoodWindow::buttonLeave(qintptr button)
{
case HTMINBUTTON:
{
emit captionButtonStateChanged(CaptionButtonState::MinimizeHoverLeave);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MinimizeHoverLeave);

break;
}
case HTMAXBUTTON:
{
emit captionButtonStateChanged(CaptionButtonState::MaximizeHoverLeave);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MaximizeHoverLeave);

break;
}
case HTCLOSE:
{
emit captionButtonStateChanged(CaptionButtonState::CloseHoverLeave);
Q_EMIT captionButtonStateChanged(CaptionButtonState::CloseHoverLeave);

break;
}
Expand All @@ -4194,7 +4194,7 @@ bool QGoodWindow::buttonPress(qintptr button)
m_is_caption_button_pressed = true;
m_caption_button_pressed = HTMINBUTTON;

emit captionButtonStateChanged(CaptionButtonState::MinimizePress);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MinimizePress);

activateWindow();

Expand All @@ -4205,7 +4205,7 @@ bool QGoodWindow::buttonPress(qintptr button)
m_is_caption_button_pressed = true;
m_caption_button_pressed = HTMAXBUTTON;

emit captionButtonStateChanged(CaptionButtonState::MaximizePress);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MaximizePress);

activateWindow();

Expand All @@ -4216,7 +4216,7 @@ bool QGoodWindow::buttonPress(qintptr button)
m_is_caption_button_pressed = true;
m_caption_button_pressed = HTCLOSE;

emit captionButtonStateChanged(CaptionButtonState::ClosePress);
Q_EMIT captionButtonStateChanged(CaptionButtonState::ClosePress);

activateWindow();

Expand Down Expand Up @@ -4247,35 +4247,35 @@ bool QGoodWindow::buttonRelease(qintptr button, bool valid_click)
{
case HTMINBUTTON:
{
emit captionButtonStateChanged(CaptionButtonState::MinimizeRelease);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MinimizeRelease);

if (valid_click)
{
emit captionButtonStateChanged(CaptionButtonState::MinimizeClicked);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MinimizeClicked);
m_hover_timer->start();
}

return true;
}
case HTMAXBUTTON:
{
emit captionButtonStateChanged(CaptionButtonState::MaximizeRelease);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MaximizeRelease);

if (valid_click)
{
emit captionButtonStateChanged(CaptionButtonState::MaximizeClicked);
Q_EMIT captionButtonStateChanged(CaptionButtonState::MaximizeClicked);
m_hover_timer->start();
}

return true;
}
case HTCLOSE:
{
emit captionButtonStateChanged(CaptionButtonState::CloseRelease);
Q_EMIT captionButtonStateChanged(CaptionButtonState::CloseRelease);

if (valid_click)
{
emit captionButtonStateChanged(CaptionButtonState::CloseClicked);
Q_EMIT captionButtonStateChanged(CaptionButtonState::CloseClicked);
m_hover_timer->start();
}

Expand Down
4 changes: 2 additions & 2 deletions QGoodWindow/QGoodWindow/src/qgoodwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class QGOODWINDOW_SHARED_EXPORT QGoodWindow : public QMainWindow
static QGoodStateHolder *qGoodStateHolderInstance();

/*** QGOODWINDOW FUNCTIONS END ***/
signals:
Q_SIGNALS:
/** On handled caption buttons, this SIGNAL report the state of these buttons. */
void captionButtonStateChanged(const QGoodWindow::CaptionButtonState &state);

Expand Down Expand Up @@ -238,7 +238,7 @@ class QGOODWINDOW_SHARED_EXPORT QGoodWindow : public QMainWindow
Q_DECL_DEPRECATED QRect rightCaptionButtonsRect() const
{Q_ASSERT(false); return QRect();}

public slots:
public Q_SLOTS:
/** Set title bar height for *QGoodWindow*. */
void setTitleBarHeight(int height);

Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/QGoodWindow/src/shadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Shadow : public QWidget
explicit Shadow(qintptr hwnd, QGoodWindow *gw, QWidget *parent);
#endif

public slots:
public Q_SLOTS:
void showLater();
void show();
void hide();
Expand Down
2 changes: 2 additions & 0 deletions QGoodWindow/build-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ else()
add_library(${PROJECT_NAME} STATIC)
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE QT_NO_KEYWORDS)

set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Set build mode")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release MinSizeRel RelWithDebInfo Debug)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

TEMPLATE = lib

CONFIG += plugin
CONFIG += plugin no_keywords

TARGET = QGoodWindow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

TEMPLATE = lib

CONFIG += staticlib
CONFIG += staticlib no_keywords

TARGET = QGoodWindow

Expand Down
2 changes: 1 addition & 1 deletion QGoodWindow/build-library/build-qgoodwindow-static-lib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

TEMPLATE = lib

CONFIG += staticlib
CONFIG += staticlib no_keywords

TARGET = QGoodWindow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

TEMPLATE = lib

CONFIG += plugin
CONFIG += plugin no_keywords

TARGET = QGoodWindow

Expand Down

0 comments on commit 04a084c

Please sign in to comment.