mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
Check for NULL icon
This commit is contained in:
committed by
Mat Sutcliffe
parent
cffab0954d
commit
3c633af365
@@ -826,8 +826,10 @@ namespace BlackGui
|
|||||||
QPointer<QWidget> w = CGuiApplication::mainApplicationWidget();
|
QPointer<QWidget> w = CGuiApplication::mainApplicationWidget();
|
||||||
if (!w) { return; }
|
if (!w) { return; }
|
||||||
const QSize iconSize = CIcons::empty16().size();
|
const QSize iconSize = CIcons::empty16().size();
|
||||||
|
static QPixmap iconEmpty;
|
||||||
|
|
||||||
QPixmap icon = w->style()->standardIcon(QStyle::SP_TitleBarMaxButton).pixmap(iconSize);
|
QPixmap icon = w->style()->standardIcon(QStyle::SP_TitleBarMaxButton).pixmap(iconSize);
|
||||||
QAction *a = menu.addAction(icon.scaled(iconSize), "Fullscreen");
|
QAction *a = menu.addAction(icon.isNull() ? iconEmpty : icon.scaled(iconSize), "Fullscreen");
|
||||||
bool c = connect(a, &QAction::triggered, this, [ = ]()
|
bool c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
if (!w) { return; }
|
if (!w) { return; }
|
||||||
@@ -836,7 +838,7 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
icon = w->style()->standardIcon(QStyle::SP_TitleBarMinButton).pixmap(iconSize);
|
icon = w->style()->standardIcon(QStyle::SP_TitleBarMinButton).pixmap(iconSize);
|
||||||
a = menu.addAction(icon.scaled(iconSize), "Minimize");
|
a = menu.addAction(icon.isNull() ? iconEmpty : icon.scaled(iconSize), "Minimize");
|
||||||
c = connect(a, &QAction::triggered, this, [ = ]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
if (!w) { return; }
|
if (!w) { return; }
|
||||||
@@ -845,7 +847,7 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
icon = w->style()->standardIcon(QStyle::SP_TitleBarNormalButton).pixmap(iconSize);
|
icon = w->style()->standardIcon(QStyle::SP_TitleBarNormalButton).pixmap(iconSize);
|
||||||
a = menu.addAction(icon.scaled(iconSize), "Normal");
|
a = menu.addAction(icon.isNull() ? iconEmpty : icon.scaled(iconSize), "Normal");
|
||||||
c = connect(a, &QAction::triggered, this, [ = ]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
if (!w) { return; }
|
if (!w) { return; }
|
||||||
|
|||||||
Reference in New Issue
Block a user