Refactor build system and UI
+ Install configs for Qt Designer plugins and Qtk application + Add Qtk plugin collection for Qt Designer + QtkWidget plugin + TreeView widget plugin + DebugConsole widget plugin + All widgets are fully integrated with Qt Designer + All widgets can be popped out or docked within the window + All widgets can be stacked to use tab view for side panels + All widgets can be toggled on/off through the view context menu + QtkWidget debug console + QtkWidget active scene TreeVew + QtkWidget dockable tool bar + Double-click an object name in the TreeView to focus camera + Separate libaray from widgets There is still a lot to do here, but the major refactoring should be done after this commit. Some of the new features were put together as POC for working with the new UI. A few placeholder buttons were added that have no functionality.
This commit is contained in:
88
src/app/widgetplugin.cpp
Normal file
88
src/app/widgetplugin.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Generic Qt Designer widget plugin ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
################################################################################
|
||||
*/
|
||||
|
||||
#include <QIcon>
|
||||
#include <QtPlugin>
|
||||
#include <utility>
|
||||
|
||||
#include "qtk/qtkapi.h"
|
||||
|
||||
#include "widgetplugin.h"
|
||||
|
||||
WidgetPlugin::WidgetPlugin(
|
||||
QString group, QString class_name, QString include,
|
||||
WidgetPlugin::Factory factory) :
|
||||
m_group(std::move(group)),
|
||||
m_className(std::move(class_name)), m_includeFile(std::move(include)),
|
||||
m_factory(std::move(factory)), m_objectName(class_name) {}
|
||||
|
||||
QString WidgetPlugin::toolTip() const {
|
||||
return QStringLiteral("A custom widget tool tip.");
|
||||
}
|
||||
|
||||
QString WidgetPlugin::whatsThis() const {
|
||||
return QStringLiteral("Custom widget what's this?");
|
||||
}
|
||||
|
||||
QIcon WidgetPlugin::icon() const {
|
||||
return Qtk::getIcon();
|
||||
}
|
||||
|
||||
bool WidgetPlugin::isContainer() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
QString WidgetPlugin::group() const {
|
||||
return m_group;
|
||||
}
|
||||
|
||||
QString WidgetPlugin::name() const {
|
||||
return m_className;
|
||||
}
|
||||
|
||||
QString WidgetPlugin::includeFile() const {
|
||||
return m_includeFile;
|
||||
}
|
||||
|
||||
QWidget * WidgetPlugin::createWidget(QWidget * parent) {
|
||||
return m_factory(parent);
|
||||
}
|
||||
|
||||
bool WidgetPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
void WidgetPlugin::initialize(QDesignerFormEditorInterface *) {
|
||||
if(m_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
QString WidgetPlugin::domXml() const {
|
||||
return
|
||||
"<ui language=\"c++\">\n"
|
||||
" <widget class=\"" + m_className + "\" name=\"" + m_objectName + "\">\n"
|
||||
" <property name=\"geometry\">\n"
|
||||
" <rect>\n"
|
||||
" <x>0</x>\n"
|
||||
" <y>0</y>\n"
|
||||
" <width>100</width>\n"
|
||||
" <height>100</height>\n"
|
||||
" </rect>\n"
|
||||
" </property>\n"
|
||||
" <property name=\"toolTip\" >\n"
|
||||
" <string>" + toolTip() + "</string>\n"
|
||||
" </property>\n"
|
||||
" <property name=\"whatsThis\" >\n"
|
||||
" <string>" + whatsThis() + "</string>\n"
|
||||
" </property>\n"
|
||||
" </widget>\n"
|
||||
"</ui>\n";
|
||||
}
|
||||
Reference in New Issue
Block a user