aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/guiutil.h')
-rw-r--r--src/qt/guiutil.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 52124ff20a..26202e8d41 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -8,6 +8,8 @@
#include <QMessageBox>
#include <QObject>
#include <QString>
+#include <QTableView>
+#include <QHeaderView>
class QValidatedLineEdit;
class SendCoinsRecipient;
@@ -116,6 +118,44 @@ namespace GUIUtil
int size_threshold;
};
+ /**
+ * Makes a QTableView last column feel as if it was being resized from its left border.
+ * Also makes sure the column widths are never larger than the table's viewport.
+ * In Qt, all columns are resizable from the right, but it's not intuitive resizing the last column from the right.
+ * Usually our second to last columns behave as if stretched, and when on strech mode, columns aren't resizable
+ * interactively or programatically.
+ *
+ * This helper object takes care of this issue.
+ *
+ */
+ class TableViewLastColumnResizingFixer: public QObject
+ {
+ Q_OBJECT
+ public:
+ TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth);
+ void stretchColumnWidth(int column);
+
+ private:
+ QTableView* tableView;
+ int lastColumnMinimumWidth;
+ int allColumnsMinimumWidth;
+ int lastColumnIndex;
+ int columnCount;
+ int secondToLastColumnIndex;
+
+ void adjustTableColumnsWidth();
+ int getAvailableWidthForColumn(int column);
+ int getColumnsWidth();
+ void connectViewHeadersSignals();
+ void disconnectViewHeadersSignals();
+ void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode);
+ void resizeColumn(int nColumnIndex, int width);
+
+ private slots:
+ void on_sectionResized(int logicalIndex, int oldSize, int newSize);
+ void on_geometriesChanged();
+ };
+
bool GetStartOnSystemStartup();
bool SetStartOnSystemStartup(bool fAutoStart);