Better compatible with qt4.

* Q_PROPERTY MEMBER wasn't available, use READ and WRITE instead
* Disables namespace with qt4
* Updates default stylesheet to work with qt4 (no namespaces)

Unifies include/forward-declaration style in header files.
README status updates
This commit is contained in:
mfreiholz 2016-02-15 12:27:23 +01:00
parent 2d1a3b8665
commit 2513ab1f2b
10 changed files with 22 additions and 36 deletions

View File

@ -10,6 +10,8 @@ CONFIG += staticlib
INCLUDEPATH += $$PWD/src
INCLUDEPATH += $$PWD/include
greaterThan(QT_MAJOR_VERSION, 4): DEFINES += ADS_NAMESPACE_ENABLED
windows {
# MinGW
*-g++* {

View File

@ -7,12 +7,9 @@
#include <QSharedPointer>
class QSplitter;
/*
* ADS - Advanced Docking System for Qt
* Developed by Manuel Freiholz
*/
#if 1
// Use namespace
// Disabled with Qt4!
#ifdef ADS_NAMESPACE_ENABLED
#define ADS_NAMESPACE_BEGIN namespace ads {
#define ADS_NAMESPACE_END }
#define ADS_NS ads

View File

@ -3,14 +3,12 @@
#include <QWidget>
#include <QFrame>
class QBoxLayout;
#include "ads/API.h"
#include "ads/SectionContent.h"
class QBoxLayout;
ADS_NAMESPACE_BEGIN
class ContainerWidget;
class SectionTitleWidget;
class SectionContentWidget;

View File

@ -7,7 +7,6 @@
#include "ads/SectionContent.h"
ADS_NAMESPACE_BEGIN
class ContainerWidget;
class SectionWidget;

View File

@ -15,7 +15,7 @@ class FloatingWidget;
class SectionTitleWidget : public QFrame
{
Q_OBJECT
Q_PROPERTY(bool activeTab MEMBER _activeTab NOTIFY activeTabChanged)
Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged)
friend class ContainerWidget;
friend class SectionWidget;

View File

@ -5,15 +5,13 @@
#include <QList>
#include <QHash>
#include <QFrame>
class QBoxLayout;
class QStackedLayout;
#include "ads/API.h"
#include "ads/SectionContent.h"
class QBoxLayout;
class QStackedLayout;
ADS_NAMESPACE_BEGIN
class ContainerWidget;
class SectionTitleWidget;
class SectionContentWidget;
@ -33,7 +31,6 @@ public:
virtual ~SectionWidget();
int uid() const;
ContainerWidget* containerWidget() const;
QRect titleAreaGeometry() const;
QRect contentAreaGeometry() const;

View File

@ -431,6 +431,7 @@ SectionWidget* ContainerWidget::dropContentOuterHelper(QLayout* l, const Interna
#else
int index = l->indexOf(oldsp);
QLayoutItem* li = l->takeAt(index);
l->addWidget(sp);
sp->addWidget(oldsp);
sp->addWidget(sw);
delete li;
@ -447,6 +448,7 @@ SectionWidget* ContainerWidget::dropContentOuterHelper(QLayout* l, const Interna
sp->addWidget(sw);
int index = l->indexOf(oldsp);
QLayoutItem* li = l->takeAt(index);
l->addWidget(sp);
sp->addWidget(oldsp);
delete li;
#endif

View File

@ -79,11 +79,6 @@ int SectionWidget::uid() const
return _uid;
}
ContainerWidget* SectionWidget::containerWidget() const
{
return _container;
}
QRect SectionWidget::titleAreaGeometry() const
{
return _tabsLayout->geometry();
@ -167,8 +162,6 @@ bool SectionWidget::takeContent(int uid, InternalContentData& data)
{
_tabsLayout->removeWidget(title);
title->disconnect(this);
// if (del)
// title->deleteLater();
}
// Content wrapper widget (CONTENT)
@ -177,8 +170,6 @@ bool SectionWidget::takeContent(int uid, InternalContentData& data)
{
_contentsLayout->removeWidget(content);
content->disconnect(this);
// if (del)
// content->deleteLater();
}
// Select the previous tab as activeTab.

View File

@ -41,11 +41,11 @@ int main(int argc, char *argv[])
// Default style.
a.setStyleSheet(""
" QSplitter::handle { background: palette(dark); } "
" ads--ContainerWidget { background: palette(dark); } "
" ads--SectionWidget { background: palette(window); } "
" ads--SectionTitleWidget { background: palette(window); } "
" ads--SectionTitleWidget[activeTab=\"true\"] { background: palette(light); } "
" ads--SectionContentWidget { border: 1px solid palette(light); } "
" ads--ContainerWidget, ContainerWidget { background: palette(dark); } "
" ads--SectionWidget, SectionWidget { background: palette(window); } "
" ads--SectionTitleWidget, SectionTitleWidget { background: palette(window); } "
" ads--SectionTitleWidget[activeTab=\"true\"], SectionTitleWidget[activeTab=\"true\"] { background: palette(light); } "
" ads--SectionContentWidget, SectionContentWidget { border: 1px solid palette(light); } "
" "
);

View File

@ -1,12 +1,12 @@
# Advanced Docking System
Manages content widgets a lot like Visual Studio or similar programs.
Manages content widgets more like Visual Studio or similar programs.
I also try to get everything done with basic Qt functionality.
Basic usage of QWidgets an QLayouts and using basic styles as much as possible.
## Requirements (Tested!)
## Tested with - Requirements
**Windows**
- \>= Qt 5.5
- VC12 or MinGW (-std=c++11)
- \>= Qt 5.5, VC12 or MinGW
- \>= Qt 4.5.3 VC9 - *not as good...*
**Linux**
- Not yet tested
@ -21,10 +21,10 @@ Open the `build.pro` with QtCreator and start the build, that's it.
## TODOs
Sorted by priority
- Improve FloatingWidget (Remove maximize button, only support close-button which hides the widget)
- **[DONE]** Improve FloatingWidget (Remove maximize button, only support close-button which hides the widget)
- **[DONE]** Serialize and Deserialize state/size/positions of dockings
- Serialize FloatingWidget states
- **[90%]** Make compatible with Qt 4.5 (\*ROFL!\*)
- Save and restore FloatingWidget states
- Drop indicator images should be fully visible over the DropOverlay rectangle
- Pin contents: Pins a content and its title widget to the edge and opens on click/hover as long as it has focus