Qt Advanced Docking System
v1.0.0
管理內容小工具更像是 Visual Studio 或類似程式。我還嘗試使用基本的 Qt 功能來完成所有工作。 QWidgets 和 QLayouts 的基本用法,並盡可能使用基本樣式。
用QtCreator打開build.pro
並開始構建,就是這樣。您可以執行演示項目並自行測試。
master
分支不能保證穩定,甚至無法構建,因為它是主要工作分支。如果您想要一個可以建立的版本,您應該始終使用發布/測試版標籤。
以下範例顯示了使用 ADS 所需的最少程式碼。
我的視窗.h
# include < QMainWindow >
# include " ads/API.h "
# include " ads/ContainerWidget.h "
# include " ads/SectionContent.h "
class MyWindow : public QMainWindow
{
Q_OBJECT
public:
MyWindow (QWidget* parent);
private:
// The main container for dockings.
ADS_NS::ContainerWidget* _container;
// You always want to keep a reference of your content,
// in case you need to perform any action on it (show, hide, ...)
ADS_NS::SectionContent::RefPtr _sc1;
};
我的視窗.cpp
# include " MyWindow.h "
# include < QLabel >
MyWindow::MyWindow (QWidget* parent) : QMainWindow(parent)
{
_container = new ADS_NS::ContainerWidget ();
setCentralWidget (_container);
_sc1 = ADS_NS::SectionContent::newSectionContent ( QString ( " Unique-Internal-Name " ), _container, new QLabel ( " Visible Title " ), new QLabel ( " Content Widget " ));
_container-> addSectionContent (_sc1, NULL , ADS_NS::CenterDropArea);
}
static void initStyleSheet (QApplication& a)
{
// Q_INIT_RESOURCE(ads); // If static linked.
QFile f ( " :ads/stylesheets/default-windows.css " );
if (f. open (QFile::ReadOnly))
{
const QByteArray ba = f. readAll ();
f. close ();
a. setStyleSheet ( QString (ba));
}
}
int main ( int argc, char *argv[])
{
QApplication a (argc, argv);
a. setQuitOnLastWindowClosed ( true );
initStyleSheet (a);
MainWindow mw;
mw. show ();
return a. exec ();
}
Manuel Freiholz,專案維護者
此專案使用 WTFPL授權(Do W hat T he Fuck You Want To Public License )
使用它嗎?透過建立新問題讓我們知道(當然,您不必這樣做)。