Custom TableView inside .ui file doesnt work/gets called
-
Hey guys!
I have a UserSite that is stored in a .ui file. This ui files gets loaded in a .cpp file from the UiLoader. In this .ui file is a "promoted" custom QTableWidget 'TableWidget'. But this doesnt work. When I load the .ui file and display it the default QTableView shows up. I searched for over an hour now but cant find the issue. Because the error could be anywhere Ill give you a link to the github repo. Its not a big project and the only dependency (spdlog) is already included. You only need to build it with CMake.
Thank you for your help :) -
I would guess you will need the designer plugin so QUILoader can create your custom widget. See also QUILoader::addPluginPath()
-
I would guess you will need the designer plugin so QUILoader can create your custom widget. See also QUILoader::addPluginPath()
@Christian-Ehrlicher If I understand this its to display it in the Qt Designer, right?
If so this is nat what I want to do. Im talking about runtime. At runtime the wrong/standard QTabelView is called. -
@Christian-Ehrlicher If I understand this its to display it in the Qt Designer, right?
If so this is nat what I want to do. Im talking about runtime. At runtime the wrong/standard QTabelView is called.@VogelPapaFinn said in Custom TableView inside .ui file doesnt work/gets called:
If I understand this its to display it in the Qt Designer, right?
I would guess you will need the designer plugin so QUILoader can create your custom widget.
You said you're using the QUILoader at runtime, I told you that the QUILoader probably needs the designer plugin so it can create the widget.
-
Hi,
As @Christian-Ehrlicher wrote, you need the plugin to load your custom widget. See QUiLoader::addPluginPath.
The code you linked does not contain any call to QUiLoader though.That said, do you really need QUiLoader rather than compiling the ui forms ?
-
Hi,
As @Christian-Ehrlicher wrote, you need the plugin to load your custom widget. See QUiLoader::addPluginPath.
The code you linked does not contain any call to QUiLoader though.That said, do you really need QUiLoader rather than compiling the ui forms ?
Oh then I missunserstood sorry for that! Ill give that a try.
@SGaist the src/UserSite.cpp contains a QUiLoader in the constructor. -
My bad, it's the one file I missed and the GitHub search did not return any hit.
Anyway, before building a plugin, do you really have the need for using the loader VS compiling everything ?
-
Hi,
As @Christian-Ehrlicher wrote, you need the plugin to load your custom widget. See QUiLoader::addPluginPath.
The code you linked does not contain any call to QUiLoader though.That said, do you really need QUiLoader rather than compiling the ui forms ?
@SGaist what I forgot: I think I need to load it, yes. I have a main .ui file that has a stacked widget. This represents different sites. I create different .ui files that represent these sites and get loaded at runtime.
-
@SGaist what I forgot: I think I need to load it, yes. I have a main .ui file that has a stacked widget. This represents different sites. I create different .ui files that represent these sites and get loaded at runtime.
But why do you need to load them at runtime? I don't see a need for it.
-
But why do you need to load them at runtime? I don't see a need for it.
@Christian-Ehrlicher what would you do? Im quite new to Qt so Im open to new techniques/ideas etc. :)
// this 10 minute post cooldown sucks :|
-
Simply create the widgets normally and add those to your stackedwidget if you don't want to add everything into one ui file.
-
Simply use them as any other widgets.