mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +08:00
refs #577, make read only checkboxes better readable
(by not disabling them, but using a little trick)
This commit is contained in:
@@ -132,9 +132,9 @@ namespace BlackGui
|
|||||||
this->ui->le_Family->setReadOnly(readOnly);
|
this->ui->le_Family->setReadOnly(readOnly);
|
||||||
this->ui->le_Iata->setReadOnly(readOnly);
|
this->ui->le_Iata->setReadOnly(readOnly);
|
||||||
|
|
||||||
this->ui->cb_Legacy->setCheckable(!readOnly);
|
CGuiUtility::checkBoxReadOnly(this->ui->cb_Legacy, readOnly);
|
||||||
this->ui->cb_Military->setCheckable(!readOnly);
|
CGuiUtility::checkBoxReadOnly(this->ui->cb_Military, readOnly);
|
||||||
this->ui->cb_RealWorld->setCheckable(!readOnly);
|
CGuiUtility::checkBoxReadOnly(this->ui->cb_RealWorld, readOnly);
|
||||||
|
|
||||||
this->ui->cb_Wtc->setEnabled(!readOnly);
|
this->ui->cb_Wtc->setEnabled(!readOnly);
|
||||||
this->ui->cb_Rank->setEnabled(!readOnly);
|
this->ui->cb_Rank->setEnabled(!readOnly);
|
||||||
|
|||||||
@@ -198,6 +198,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cb_RealWorld">
|
<widget class="QCheckBox" name="cb_RealWorld">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Real world aircraft</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Real</string>
|
<string>Real</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -205,6 +208,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cb_Legacy">
|
<widget class="QCheckBox" name="cb_Legacy">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Legacy aircraft, e.g. Concord, ME109</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Legacy</string>
|
<string>Legacy</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -213,7 +219,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cb_Military">
|
<widget class="QCheckBox" name="cb_Military">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Military</string>
|
<string>Military aircraft</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mil.</string>
|
<string>Mil.</string>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "blackmisc/filelogger.h"
|
#include "blackmisc/filelogger.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/project.h"
|
#include "blackmisc/project.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
@@ -200,11 +201,29 @@ namespace BlackGui
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGuiUtility::checkBoxReadOnly(QCheckBox *checkBox, bool readOnly)
|
||||||
|
{
|
||||||
|
static const QCheckBox defaultBox;
|
||||||
|
BLACK_VERIFY_X(checkBox, Q_FUNC_INFO, "no checkbox");
|
||||||
|
if (!checkBox) { return; }
|
||||||
|
|
||||||
|
if (readOnly)
|
||||||
|
{
|
||||||
|
checkBox->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
checkBox->setFocusPolicy(Qt::NoFocus);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkBox->setAttribute(Qt::WA_TransparentForMouseEvents, defaultBox.testAttribute(Qt::WA_TransparentForMouseEvents));
|
||||||
|
checkBox->setFocusPolicy(defaultBox.focusPolicy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QWidgetList CGuiUtility::topLevelApplicationWidgetsWithName()
|
QWidgetList CGuiUtility::topLevelApplicationWidgetsWithName()
|
||||||
{
|
{
|
||||||
QWidgetList tlw = QApplication::topLevelWidgets();
|
QWidgetList tlw = QApplication::topLevelWidgets();
|
||||||
QWidgetList rl;
|
QWidgetList rl;
|
||||||
foreach(QWidget * w, tlw)
|
foreach (QWidget *w, tlw)
|
||||||
{
|
{
|
||||||
if (w->objectName().isEmpty()) { continue; }
|
if (w->objectName().isEmpty()) { continue; }
|
||||||
rl.append(w);
|
rl.append(w);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "enableforframelesswindow.h"
|
#include "enableforframelesswindow.h"
|
||||||
#include <QWidgetList>
|
#include <QWidgetList>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -80,6 +81,9 @@ namespace BlackGui
|
|||||||
//! Metatype
|
//! Metatype
|
||||||
static const QString &swiftJsonDragAndDropMimeType();
|
static const QString &swiftJsonDragAndDropMimeType();
|
||||||
|
|
||||||
|
//! Pseudo readonly state for checkbox
|
||||||
|
static void checkBoxReadOnly(QCheckBox *checkBox, bool readOnly);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Constructor, use static methods only
|
//! Constructor, use static methods only
|
||||||
CGuiUtility() {}
|
CGuiUtility() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user