refs #299, dockable widgets improvements

* preferred size instead of a auto adjustment for floatable widgets
* hack for hiding the tabbar (it still cosnumes space)
This commit is contained in:
Klaus Basan
2014-08-04 02:24:20 +02:00
parent d3858a8b37
commit 3c12cd7b30
5 changed files with 112 additions and 35 deletions

View File

@@ -12,6 +12,7 @@
#ifndef BLACKGUI_DOCKWIDGET_H
#define BLACKGUI_DOCKWIDGET_H
#include "components/runtimebasedcomponent.h"
#include <QDockWidget>
#include <QTabWidget>
#include <QMenu>
@@ -50,9 +51,6 @@ namespace BlackGui
//! Margins when widget is floating
void setMarginsWhenDocked(int left, int top, int right, int bottom) { this->m_marginsWhenDocked = QMargins(left, top, right, bottom); }
//! Auto adjust size when floating
void setAutoAdjustWhenFloating(bool autoAdjust) { this->m_autoAdjustWhenFloating = autoAdjust; }
//! Window title backup
const QString &windowTitleBackup() const { return this->m_windowTitleBackup; }
@@ -62,6 +60,15 @@ namespace BlackGui
//! Show the window title when docked
void showTitleWhenDocked(bool show);
//! Reset first time floating
void resetWasAlreadyFLoating() { this->m_wasAlreadyFloating = false; }
//! Was widget already floating
bool wasAlreadyFloating() const { return this->m_wasAlreadyFloating; }
//! Size when floating
void setPreferredSizeWhenFloating(const QSize &size) { this->m_preferredSizeWhenFloating = size; }
public slots:
//! Toggle floating
void toggleFloating();
@@ -101,10 +108,15 @@ namespace BlackGui
QMargins m_marginsWhenDocked; //!< Offsets when window is floating
QString m_windowTitleBackup; //!< original title, even if the widget title is deleted for layout purposes
bool m_windowTitleWhenDocked = true;
bool m_autoAdjustWhenFloating = true;
bool m_wasAlreadyFloating = false;
QSize m_preferredSizeWhenFloating;
//! Empty widget with no size
void initTitleBarWidgets();
//! Find all embedded runtime components
QList<QWidget *> findEmbeddedRuntimeComponents() const;
};
} // namespace