aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/settings/SettingsNetwork.cpp8
-rw-r--r--src/ui/widgets/GRTTreeView.cpp26
-rw-r--r--src/ui/widgets/GRTTreeView.h30
3 files changed, 60 insertions, 4 deletions
diff --git a/src/ui/dialog/settings/SettingsNetwork.cpp b/src/ui/dialog/settings/SettingsNetwork.cpp
index c7e1e9f6..a923e5a2 100644
--- a/src/ui/dialog/settings/SettingsNetwork.cpp
+++ b/src/ui/dialog/settings/SettingsNetwork.cpp
@@ -29,6 +29,7 @@
#include "SettingsNetwork.h"
#include "core/function/GlobalSettingStation.h"
+#include "core/module/ModuleManager.h"
#include "ui/thread/ProxyConnectionTestTask.h"
#include "ui_NetworkSettings.h"
@@ -86,8 +87,11 @@ GpgFrontend::UI::NetworkTab::NetworkTab(QWidget *parent)
ui_->forbidALLGnuPGNetworkConnectionCheckBox->setText(
tr("Forbid all GnuPG network connection."));
- ui_->prohibitUpdateCheck->setText(
- tr("Prohibit checking for version updates when the program starts."));
+
+ if (Module::IsModuleActivate(kVersionCheckingModuleID)) {
+ ui_->prohibitUpdateCheck->setText(
+ tr("Prohibit checking for version updates when the program starts."));
+ }
ui_->autoImportMissingKeyCheckBox->setText(
tr("Automatically import a missing key for signature verification."));
ui_->networkAbilityTipsLabel->setText(
diff --git a/src/ui/widgets/GRTTreeView.cpp b/src/ui/widgets/GRTTreeView.cpp
index f2ae42c2..09d7dcf0 100644
--- a/src/ui/widgets/GRTTreeView.cpp
+++ b/src/ui/widgets/GRTTreeView.cpp
@@ -33,10 +33,34 @@
namespace GpgFrontend::UI {
-GRTTreeView::GRTTreeView(QWidget *parent) : QTreeView(parent) {
+GRTTreeView::GRTTreeView(QWidget* parent) : QTreeView(parent) {
setModel(new Module::GlobalRegisterTableTreeModel(
Module::ModuleManager::GetInstance().GRT()));
+
+ connect(model(), &QFileSystemModel::layoutChanged, this,
+ &GRTTreeView::slot_adjust_column_widths);
+ connect(model(), &QFileSystemModel::dataChanged, this,
+ &GRTTreeView::slot_adjust_column_widths);
+ connect(this, &GRTTreeView::expanded, this,
+ &GRTTreeView::slot_adjust_column_widths);
+ connect(this, &GRTTreeView::collapsed, this,
+ &GRTTreeView::slot_adjust_column_widths);
}
GRTTreeView::~GRTTreeView() = default;
+
+void GRTTreeView::paintEvent(QPaintEvent* event) {
+ QTreeView::paintEvent(event);
+
+ if (!initial_resize_done_) {
+ slot_adjust_column_widths();
+ initial_resize_done_ = true;
+ }
+}
+
+void GRTTreeView::slot_adjust_column_widths() {
+ for (int i = 0; i < model()->columnCount(); ++i) {
+ this->resizeColumnToContents(i);
+ }
+}
} // namespace GpgFrontend::UI \ No newline at end of file
diff --git a/src/ui/widgets/GRTTreeView.h b/src/ui/widgets/GRTTreeView.h
index e730b698..6f3f83c8 100644
--- a/src/ui/widgets/GRTTreeView.h
+++ b/src/ui/widgets/GRTTreeView.h
@@ -33,9 +33,37 @@ namespace GpgFrontend::UI {
class GRTTreeView : public QTreeView {
Q_OBJECT
public:
- explicit GRTTreeView(QWidget *parent);
+ /**
+ * @brief Construct a new GRTTreeView object
+ *
+ * @param parent
+ */
+ explicit GRTTreeView(QWidget* parent);
+ /**
+ * @brief Destroy the GRTTreeView object
+ *
+ */
virtual ~GRTTreeView() override;
+
+ protected:
+ /**
+ * @brief
+ *
+ * @param event
+ */
+ void paintEvent(QPaintEvent* event) override;
+
+ private slots:
+
+ /**
+ * @brief
+ *
+ */
+ void slot_adjust_column_widths();
+
+ private:
+ bool initial_resize_done_ = false;
};
} // namespace GpgFrontend::UI \ No newline at end of file