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] Class does not name a type
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Class does not name a type

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 3.5k 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.
  • S Offline
    S Offline
    sharon_obl82
    wrote on 20 Jun 2014, 07:22 last edited by
    #1

    Hi, can someone please help to look at this, I'm baffled as I did the same thing for two items and it worked for one but not the other. When I try to compile i get "RadioWindow does not name a type'

    I have a Find window which will call Report and Radio window. It can open the Report window but not the Radio window.

    Findform.h
    @
    #include <QMainWindow>
    #include "radiowindow.h"
    #include "reportwindow.h"

    private:
    Ui::Findform *ui;
    RadioWindow *radiowindow_rf; //error RadioWindows does not name a type
    Reportwindow *report_rf;

    @

    in Findform.cpp
    @
    void Findform::on_actionNew_Ctrl_N_find_triggered()
    {
    radiowindow_rf =new RadioWindow(this);
    radiowindow_rf->setWindowIcon(QIcon(":/icons/radio.ico"));
    radiowindow_rf->setWindowTitle("Radio - User Configuration Manager");
    radiowindow_rf->show();
    }

    void Findform::on_actionReport_triggered()
    {
    report_rf =new Reportwindow(this);
    report_rf->setWindowIcon(QIcon(":/icons/qt-icon80.ico"));
    report_rf->setWindowTitle("Radio - User Configuration Manager");
    report_rf->show();
    }

    @

    I also have a form called radiowindow.h and radiowindow.cpp that calls Find window implemented with the same method, not sure if this would conflict it

    radiowindow.h
    @

    #include "findform.h"
    #include <QMainWindow>

    private:
    Ui::RadioWindow *ui;
    RadioWindow *radiowindow_r;
    Findform *find_r;
    };
    @

    radiowindow.cpp
    @
    RadioWindow::RadioWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::RadioWindow)
    {
    ui->setupUi(this);

    }
    void RadioWindow::on_actionFind_triggered()
    {
    find_r=new Findform(this);
    find_r->setWindowIcon(QIcon(":/icons/qt-icon80.ico"));
    find_r->setWindowTitle("Radio - User Configuration Manager");
    find_r->show();
    find_r->setvalueFind();
    }
    @

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 20 Jun 2014, 08:31 last edited by
      #2

      You have a circural dependency: RadioWindow includes FindForm, and FindForm includes RadioWindow. You need to restructure your code.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sharon_obl82
        wrote on 20 Jun 2014, 08:37 last edited by
        #3

        sierdzio,
        do you have any idea how I should restructure it ? :(
        you see, the problem is, i call those windows via the menu like New (will call Radio Window), Find (will call Find window)

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 20 Jun 2014, 08:45 last edited by
          #4

          Here is a nice summary: "link":http://stackoverflow.com/questions/625799/resolve-circular-dependencies-in-c.

          Or you can delegate opeing of FindWindow to MainWindow, and only emit a signal to do it from RadioWindow.

          (Z(:^

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sharon_obl82
            wrote on 20 Jun 2014, 08:48 last edited by
            #5

            thanks, i will look into it!

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sharon_obl82
              wrote on 24 Jun 2014, 02:39 last edited by
              #6

              Thank you sierdzio, the problem has been solved :)

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sierdzio
                Moderators
                wrote on 24 Jun 2014, 05:18 last edited by
                #7

                I'm happy to haer that. Have fun!

                (Z(:^

                1 Reply Last reply
                0

                1/7

                20 Jun 2014, 07:22

                • Login

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