diff options
Diffstat (limited to 'src/qt/guiutil.h')
-rw-r--r-- | src/qt/guiutil.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 52124ff20a..4f9416d1af 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -5,9 +5,13 @@ #ifndef GUIUTIL_H #define GUIUTIL_H +#include <QHeaderView> #include <QMessageBox> #include <QObject> #include <QString> +#include <QTableView> + +#include <boost/filesystem.hpp> class QValidatedLineEdit; class SendCoinsRecipient; @@ -116,6 +120,45 @@ 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); @@ -124,6 +167,12 @@ namespace GUIUtil /** Restore window size and position */ void restoreWindowGeometry(const QString& strSetting, const QSize &defaultSizeIn, QWidget *parent); + /* Convert QString to OS specific boost path through UTF-8 */ + boost::filesystem::path qstringToBoostPath(const QString &path); + + /* Convert OS specific boost path to QString through UTF-8 */ + QString boostPathToQString(const boost::filesystem::path &path); + } // namespace GUIUtil #endif // GUIUTIL_H |