Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SOLVED: Connect to SQL Database from a custom widget plugin
Forum Updated to NodeBB v4.3 + New Features

SOLVED: Connect to SQL Database from a custom widget plugin

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M001
    wrote on last edited by
    #1

    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 += sql

    QTDIR_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 = lib

    TARGET = $$qtLibraryTarget($$TARGET)

    target.path = $$[QT_INSTALL_PLUGINS]/designer
    INSTALLS += target

    }

    HEADERS = customwidgetplugin.h
    newlabel.h
    SOURCES = customwidgetplugin.cpp
    newlabel.cpp
    OTHER_FILES +=newlabel.json

    RESOURCES +=
    newlabel.qrc@

    1 Reply Last reply
    0
    • M Offline
      M Offline
      M001
      wrote on last edited by
      #2

      solved: switched to release mode and compiled it with no errors

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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)

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved