mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Removed external dependencies for build, fixed build system, updated preview images to reflect the current state of the library
This commit is contained in:
parent
fd76e9e62b
commit
990d3235c5
@ -1,9 +1,9 @@
|
||||
include($$(cetoni_repository)/build/qt/qtprojectsettings/common.pri)
|
||||
ADS_ROOT = $${PWD}/..
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/..
|
||||
|
||||
TARGET = AdvancedDockingSystemDemo
|
||||
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
QT += core gui widgets
|
||||
DEFINES += ADS_NAMESPACE_ENABLED
|
||||
|
||||
windows {
|
||||
# MinGW
|
||||
@ -26,12 +26,12 @@ HEADERS += \
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
|
||||
# Dependency: AdvancedDockingSystem (shared)
|
||||
win32:CONFIG(release, debug|release): LIBS += -l$$qtLinkLibrary(AdvancedDockingSystem)
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -l$$qtLinkLibrary(AdvancedDockingSystem)
|
||||
else:unix: LIBS += -L$$OUT_PWD/../AdvancedDockingSystem/ -lAdvancedDockingSystem
|
||||
win32:CONFIG(release, debug|release): LIBS += -lAdvancedDockingSystem
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -lAdvancedDockingSystemd
|
||||
else:unix: LIBS += -lAdvancedDockingSystem
|
||||
|
||||
INCLUDEPATH += ../src
|
||||
|
||||
DEPENDPATH += ../src
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QTime>
|
||||
#include <QLabel>
|
||||
@ -14,15 +13,13 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QSettings>
|
||||
#include <QDockWidget>
|
||||
#include <QDebug>
|
||||
|
||||
#include "DockManager.h"
|
||||
#include "DockWidget.h"
|
||||
#include "DockAreaWidget.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int CONTENT_COUNT = 0;
|
||||
|
||||
|
||||
static ads::CDockWidget* createLongTextLabelDockWidget(QMenu* ViewMenu)
|
||||
@ -82,8 +79,6 @@ static ads::CDockWidget* createFileSystemTreeDockWidget(QMenu* ViewMenu)
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
@ -127,16 +122,16 @@ void MainWindow::createContent()
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
QSettings Settings("Settings.ini", QSettings::IniFormat);
|
||||
/*QSettings Settings("Settings.ini", QSettings::IniFormat);
|
||||
Settings.setValue("mainWindow/Geometry", saveGeometry());
|
||||
Settings.setValue("mainWindow/DockingState", m_DockManager->saveState());
|
||||
Settings.setValue("mainWindow/DockingState", m_DockManager->saveState());*/
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionSaveState_triggered(bool)
|
||||
{
|
||||
std::cout << "MainWindow::on_actionSaveState_triggered" << std::endl;
|
||||
qDebug() << "MainWindow::on_actionSaveState_triggered";
|
||||
QSettings Settings("Settings.ini", QSettings::IniFormat);
|
||||
Settings.setValue("mainWindow/Geometry", saveGeometry());
|
||||
Settings.setValue("mainWindow/DockingState", m_DockManager->saveState());
|
||||
@ -145,7 +140,7 @@ void MainWindow::on_actionSaveState_triggered(bool)
|
||||
|
||||
void MainWindow::on_actionRestoreState_triggered(bool)
|
||||
{
|
||||
std::cout << "MainWindow::on_actionRestoreState_triggered" << std::endl;
|
||||
qDebug() << "MainWindow::on_actionRestoreState_triggered";
|
||||
QSettings Settings("Settings.ini", QSettings::IniFormat);
|
||||
restoreGeometry(Settings.value("mainWindow/Geometry").toByteArray());
|
||||
m_DockManager->restoreState(Settings.value("mainWindow/DockingState").toByteArray());
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 82 KiB |
BIN
preview.png
BIN
preview.png
Binary file not shown.
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 57 KiB |
@ -374,7 +374,6 @@ void DockAreaWidgetPrivate::updateTabsMenu()
|
||||
menu->clear();
|
||||
for (int i = 0; i < ContentsLayout->count(); ++i)
|
||||
{
|
||||
CDockWidget* DockWidget = dockWidgetAt(i);
|
||||
addTabsMenuEntry(dockWidgetAt(i), APPEND, menu);
|
||||
}
|
||||
}
|
||||
@ -449,7 +448,6 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
|
||||
d->TabsLayout->insertWidget(index, TitleBar);
|
||||
TitleBar->show();
|
||||
connect(TitleBar, SIGNAL(clicked()), this, SLOT(onDockWidgetTitleClicked()));
|
||||
connect(DockWidget, SIGNAL(viewToggled(bool)), this, SLOT(onDockWidgetViewToggled(bool)));
|
||||
DockWidget->setProperty(INDEX_PROPERTY, index);
|
||||
if (Activate)
|
||||
{
|
||||
@ -469,7 +467,6 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
|
||||
TitleBar->hide();
|
||||
d->TabsLayout->removeWidget(TitleBar);
|
||||
disconnect(TitleBar, SIGNAL(clicked()), this, SLOT(onDockWidgetTitleClicked()));
|
||||
disconnect(DockWidget, SIGNAL(viewToggled(bool)), this, SLOT(onDockWidgetViewToggled(bool)));
|
||||
setCurrentIndex(d->ContentsLayout->currentIndex());
|
||||
d->updateTabsMenu();
|
||||
|
||||
@ -707,13 +704,6 @@ void CDockAreaWidget::updateDockArea()
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::onDockWidgetViewToggled(bool Open)
|
||||
{
|
||||
auto DockWidget = dynamic_cast<CDockWidget*>(sender());
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::saveState(QDataStream& stream) const
|
||||
{
|
||||
|
@ -56,7 +56,6 @@ private slots:
|
||||
void onDockWidgetTitleClicked();
|
||||
void onTabsMenuActionTriggered(QAction* Action);
|
||||
void onCloseButtonClicked();
|
||||
void onDockWidgetViewToggled(bool Open);
|
||||
|
||||
public:
|
||||
/**
|
||||
@ -190,13 +189,6 @@ signals:
|
||||
* @param index
|
||||
*/
|
||||
void currentChanged(int index);
|
||||
|
||||
/**
|
||||
* This signal is emitted if the dock area is closed or opened.
|
||||
* The dock area will be closed, if all dock widgets in the dock area are
|
||||
* closed and will be opened, when the first dock widget is opened
|
||||
*/
|
||||
void viewToggled(bool Open);
|
||||
}; // class DockAreaWidget
|
||||
}
|
||||
// namespace ads
|
||||
|
@ -181,6 +181,7 @@ void DockContainerWidgetPrivate::dropIntoContainer(CFloatingDockContainer* Float
|
||||
QLayoutItem* li = Layout->replaceWidget(Splitter, NewSplitter);
|
||||
NewSplitter->addWidget(Splitter);
|
||||
Splitter = NewSplitter;
|
||||
delete li;
|
||||
}
|
||||
|
||||
// Now we can insert the floating widget content into this container
|
||||
@ -555,6 +556,9 @@ void DockContainerWidgetPrivate::dumpRecursive(int level, QWidget* widget)
|
||||
}
|
||||
qDebug("%sDockArea", (const char*)buf);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(level);
|
||||
Q_UNUSED(widget);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -692,7 +696,7 @@ void CDockContainerWidget::addDockArea(CDockAreaWidget* DockAreaWidget,
|
||||
Container->removeDockArea(DockAreaWidget);
|
||||
}
|
||||
|
||||
d->addDockArea(DockAreaWidget);
|
||||
d->addDockArea(DockAreaWidget, area);
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,12 +154,12 @@ bool DockManagerPrivate::restoreContainer(int Index, QDataStream& stream, bool T
|
||||
if (Index >= Containers.count())
|
||||
{
|
||||
CFloatingDockContainer* FloatingWidget = new CFloatingDockContainer(_this);
|
||||
return FloatingWidget->restoreState(stream, internal::Restore);
|
||||
return FloatingWidget->restoreState(stream, Testing);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "d->Containers[i]->restoreState ";
|
||||
return Containers[Index]->restoreState(stream, internal::Restore);
|
||||
return Containers[Index]->restoreState(stream, Testing);
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,8 +201,6 @@ bool DockManagerPrivate::restoreState(const QByteArray &state, int version)
|
||||
// Delete remaining empty floating widgets
|
||||
int FloatingWidgetIndex = i - 1;
|
||||
int DeleteCount = FloatingWidgets.count() - FloatingWidgetIndex;
|
||||
/*std::cout << "DeleteCount " << DeleteCount << " FloatingWidgets.count() "
|
||||
<< FloatingWidgets.count() << " FloatingWdgetIndex " << FloatingWidgetIndex << std::endl;*/
|
||||
for (int i = 0; i < DeleteCount; ++i)
|
||||
{
|
||||
FloatingWidgets[FloatingWidgetIndex + i]->deleteLater();
|
||||
|
@ -356,6 +356,7 @@ void CDockOverlay::enableDropPreview(bool Enable)
|
||||
//============================================================================
|
||||
void CDockOverlay::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
// Draw rect based on location
|
||||
if (!d->DropPreviewEnabled)
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ struct DockWidgetTitleBarPrivate
|
||||
* Returns true, if floating has been started and false if floating
|
||||
* is not possible for any reason
|
||||
*/
|
||||
bool startFloating(const QPoint& GlobalPos);
|
||||
bool startFloating();
|
||||
};
|
||||
// struct DockWidgetTitleBarPrivate
|
||||
|
||||
@ -158,7 +158,7 @@ void DockWidgetTitleBarPrivate::moveTab(QMouseEvent* ev)
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool DockWidgetTitleBarPrivate::startFloating(const QPoint& GlobalPos)
|
||||
bool DockWidgetTitleBarPrivate::startFloating()
|
||||
{
|
||||
qDebug() << "isFloating " << DockWidget->dockContainer()->isFloating();
|
||||
qDebug() << "areaCount " << DockWidget->dockContainer()->dockAreaCount();
|
||||
@ -187,7 +187,6 @@ bool DockWidgetTitleBarPrivate::startFloating(const QPoint& GlobalPos)
|
||||
qDebug() << "DockWidgetTitleBarPrivate::startFloating DockArea";
|
||||
// If section widget has only one content widget, we can move the complete
|
||||
// dock area into floating widget
|
||||
auto splitter = internal::findParent<QSplitter*>(DockArea);
|
||||
FloatingWidget = new CFloatingDockContainer(DockArea);
|
||||
}
|
||||
|
||||
@ -292,7 +291,7 @@ void CDockWidgetTitleBar::mouseMoveEvent(QMouseEvent* ev)
|
||||
bool MouseInsideTitleArea = d->titleAreaGeometryContains(ev->globalPos());
|
||||
if (!MouseInsideTitleArea)
|
||||
{
|
||||
d->startFloating(ev->globalPos());
|
||||
d->startFloating();
|
||||
return;
|
||||
}
|
||||
else if (d->DockArea->count() > 1
|
||||
|
@ -331,6 +331,7 @@ bool CFloatingDockContainer::event(QEvent *e)
|
||||
//============================================================================
|
||||
bool CFloatingDockContainer::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
Q_UNUSED(watched);
|
||||
if (event->type() == QEvent::MouseButtonRelease && d->DraggingActive)
|
||||
{
|
||||
qDebug() << "FloatingWidget::eventFilter QEvent::MouseButtonRelease";
|
||||
@ -389,6 +390,7 @@ void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
||||
//============================================================================
|
||||
void CFloatingDockContainer::onDockAreaCurrentChanged(int Index)
|
||||
{
|
||||
Q_UNUSED(Index);
|
||||
this->setWindowTitle(d->SingleDockArea->currentDockWidget()->windowTitle());
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
include($$(cetoni_repository)/build/qt/qtprojectsettings/shared_library.pri)
|
||||
include(src/v2/v2.pri)
|
||||
ADS_ROOT = $${PWD}/..
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/..
|
||||
|
||||
TARGET = $$qtLibraryTarget(AdvancedDockingSystem)
|
||||
TEMPLATE = lib
|
||||
#VERSION = 1.0.0
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
QT += core gui widgets
|
||||
|
||||
CONFIG += adsBuildShared
|
||||
|
||||
QT += core gui widgets
|
||||
DEFINES += ADS_NAMESPACE_ENABLED
|
||||
|
||||
adsBuildShared {
|
||||
CONFIG += shared
|
||||
|
Loading…
Reference in New Issue
Block a user