SOLVED: Connect to SQL Database from a custom widget plugin
-
Hello,
I've created a custom widget plugin and includet it into QTCreator so I can use it from the Widgetbrowser in QTDesigner to create my gui. Now I want to extend my custom widget to connect to a SQL Database to show data of the Database in my custom widget. So I write a method to connect to the Database und read the data. but when I start compiling the custom widget plugin I get many errors. is it possible to use SQL in a custom widget plugin?my profile looks like this:
@QT += widgets designer
QT += sqlQTDIR_build {
This is only for the Qt build. Do not use externally. We mean it.
PLUGIN_TYPE = designer
PLUGIN_CLASS_NAME = NewLabel
load(qt_plugin)
} else {Public example:
CONFIG += plugin
TEMPLATE = libTARGET = $$qtLibraryTarget($$TARGET)
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target}
HEADERS = customwidgetplugin.h
newlabel.h
SOURCES = customwidgetplugin.cpp
newlabel.cpp
OTHER_FILES +=newlabel.jsonRESOURCES +=
newlabel.qrc@ -
Hi,
Don't forget to also update the thread's title to solved (which it's not really since you still have a problem in debug build)