Problems with Open-Source Downloads read and

[SOLVED] Issues using QtCreator on Kubuntu 14.04

  • I'm using Qt Creator on Kubuntu 14.04 and I am having some problems. I've been googling for two days to no avail. I know I'm probably doing something wrong on a very elementary and basic level, but I can't figure out what it is.

    Kubuntu 14.04
    Qt Creator 3.0.1
    qt 5.2.1

    I am trying to make an interface using nested tabs. Set aside the hate for this for a moment and let's focus on the problem please. Whatever I do, I can't get anything after the first tab level to show. This was happening even with I only had one level of tabs and regular content was in the tab (Qlabel, etc). No idea what's going on.

    I am a complete noob to Qt, so I may be doing something wrong on a very basic level. I can't find any good books for my particular learning style (and the official documentation doesn't mix well with my style either). So I've just been hacking things together from the included examples and google.

    This is what's in main:

    #include <QApplication>
    #include "MainContentHolder.h"

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    MainContentHolder mch;;

    return a.exec&#40;&#41;;


    This is what's in the outter tab layer:

    #include "MainContentHolder.h"
    #include <string>

    MainContentHolder::MainContentHolder(QWidget* parent)
    : QMainWindow(parent)
    mainTab = new QTabWidget;
    mainTab->addTab(new DFe(), tr("dfe 01"));

    QGridLayout* layout = new QGridLayout;
    QWidget* centralWidget = new QWidget;
    resize(900, 600);


    Relevant portion of MainContentHolder.h is:

    #include "DFe.h"

    class MainContentHolder : public QMainWindow

    MainContentHolder(QWidget* parent = 0);


    And this is the inner tab layer:

    #include "DFe.h"

    DFe::DFe(QWidget* parent)
    : QWidget(parent)
    dfTab = new QTabWidget;
    dfTab->addTab(new GTab(), tr("G"));
    dfTab->addTab(new CTab(), tr("C"));
    dfTab->addTab(new DTab(), tr("D"));
    dfTab->addTab(new METab(), tr("ME"));
    dfTab->addTab(new KTab(), tr("K"));
    dfTab->addTab(new ITab(), tr("I"));

    Relevant portion of DFe.h is:

    #include <QtWidgets>
    #include "GTab.h"
    #include "CTab.h"
    #include "DTab.h"
    #include "METab.h"
    #include "KTab.h"
    #include "ITab.h"

    class DFeditGUI : public QWidget

    DFeditGUI(QWidget* parent = 0);

    QTabWidget* dfTab;

    If I remove MainContentHolder from the equation, so that DFe becomes the object inheriting from QMainWindow, the same thing occurs. The tabs show up, but no content inside the tabs. If I set some variables up inside main (int main, where QApplication is) to see if the various widgets are isVisible, it claims that it's true. So, I'm lost.

    1. Debugging doesn't work for Qt objects. From my two days of googling, I've gathered there seems to be some kind of problem with (K)Ubuntu and the newest Qt/QtCreator. I've tried all of the solutions though; and in the locals window I still only get either a "not accessible" in the debugger for Qt objects, or just their pointer address. I've tried the suggestion of building my own gdb and making sure python2 support was in there, and in the debugger log window in QtCreator, it does show that my built version is being used. The makefile created by qmake shows -g, the debugger log window seems to show the qt libraries being loaded, I've tried gdb pretty printers option on and off, I've apt-get installed qtcreator-dbg and a crapload of other packages, etc.

    I tend not to ask for help when trying to figure out programming and other tech related problems, preferring to spends days googling it if I have to, but I've exhausted google in this case and am still at square one.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You are missing a layout manager in DFe or DFeditGUI (you have a naming mismatch somewhere here) but are you sure you need that QWidget that seems to be only a container ?

    You should also consider Qt 5.3.0 since it's already out and 5.3.1 should be here soon

  • The naming mismatch is just an editing typo for purposes of the post; parts I missed. I do have a layout in the actual DFe constructor, I just didn't include it in the post. I have the declaration for layout in the header, and in the DFe constructor after all of the addTab calls, I have

    layout = new QGridLayout;

    I don't have a need for a specific type of layout just yet, so the grid layout can be changed to whatever, in case the type of layout is a problem.

    Was there something else to be done after those two lines above? Even though DFe was created as an anonymous object in MainContentHolder's addTab call, is it still counted as a parent/child relationship, therefore getting shown through the in main? Because in the addTab call in MCH, I also tried new DFe(this), and it was still the same result of no content (although a moot point if the issue is setting up layout properly in DFe).

    If you mean MainContentHolder being the container widget, yes. All of the tabs inside DFe collectively perform editing tasks on a binary file. I plan to have it where MCH can dynamically add or remove tabs (except for the last one), with each tab being a separate instance of DFe that edits a different instance of the binary file (the binary file is a saved game file from a console game, separate save files for separate runs through the game).

    EDIT: nevermind on the layout thing, I guess I forgot to call this->setLayout(layout) in the DFe constructor; since it works now after doing that. I knew it would be something elementary.

    Now, on to my second problem of not seeing anything more than pointers for qt objects in the debugger.

  • Lifetime Qt Champion

    You can also use this:

    @layout = new QGridLayout(this);@

    It will automatically set the layout on your widget.

    As for your second problem, i'd first get the latest version of Qt Creator

  • Downloaded and compiled the latest qt source. Same problem with only showing pointers for Qt objects instead of actual content in the locals and expressions during debugging. gdb is also the latest, with python2 built in.

  • Lifetime Qt Champion

    Do you also have the debugging helper built ? Have a look at Qt Versions

  • I just built Qt from git sources (previous was downloaded source tar.gz from download page), as specified "here": with the config options suggested there, and I now see actual objects instead of just pointers. Not sure what's going on or what the difference is in using the same config options between the tar.gz download and the git clone, but it works now.

Log in to reply