本文主要是介绍qt-可拖拉软件框架设计,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
qt-可拖拉软件框架设计
- 一、演示效果
- 二、实例程序
- 三、下载链接
–
一、演示效果
二、实例程序
MyWindow.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;
};
MyWindow.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();
}
三、下载链接
https://download.csdn.net/download/u013083044/88880604
这篇关于qt-可拖拉软件框架设计的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!