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. Parameters in creating window
Forum Updated to NodeBB v4.3 + New Features

Parameters in creating window

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 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.
  • E Offline
    E Offline
    Eugene404
    wrote on last edited by
    #1

    Hello. How i can transmit parameters in creating window

    class dialog:public QDialog
    {
        Q_OBJECT
    private:
        QLabel *label;
        QLabel *label1;
        QLabel *label2;
        QPushButton *ok_1;
        QPushButton *close_1;
        QLineEdit *LineEdit_1;
        QFrame *line_1;
    public:
        dialog(QWidget *parent=0, char answer); //like here new char parameter 
    private slots:
        void ok_clicked(char asnwer);
        void ok_enabled(QString);   
    }
    
    raven-worxR 1 Reply Last reply
    0
    • E Eugene404

      Hello. How i can transmit parameters in creating window

      class dialog:public QDialog
      {
          Q_OBJECT
      private:
          QLabel *label;
          QLabel *label1;
          QLabel *label2;
          QPushButton *ok_1;
          QPushButton *close_1;
          QLineEdit *LineEdit_1;
          QFrame *line_1;
      public:
          dialog(QWidget *parent=0, char answer); //like here new char parameter 
      private slots:
          void ok_clicked(char asnwer);
          void ok_enabled(QString);   
      }
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Eugene404 said in Parameters in creating window:

      dialog(QWidget *parent=0, char answer); //like here new char parameter

      default parameters can only be at the end of the parameter list. So switch position of your 2 parameters.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • E Offline
        E Offline
        Eugene404
        wrote on last edited by
        #3

        like this?

        class dialog:public QDialog
        {
            Q_OBJECT
        private:
            QLabel *label;
            QLabel *label1;
            QLabel *label2;
            QPushButton *ok_1;
            QPushButton *close_1;
            QLineEdit *LineEdit_1;
            QFrame *line_1;
        public:
            dialog(char answer,QWidget *parent=0);
        private slots:
            void ok_clicked(char asnwer);
            void ok_enabled(QString);
        };
        
        dialog::dialog(char answer,QWidget):public QDialog //constructor
        

        like this i have two errors

        1. prototype for 'dialog::dialog(char, QWidget)' does not match any in class 'dialog'
          dialog::dialog(char answer,QWidget):public QDialog
          ^
          2)candidates are: dialog::dialog(dialog&&)
          class dialog:public QDialog
          ^
        raven-worxR 1 Reply Last reply
        0
        • E Eugene404

          like this?

          class dialog:public QDialog
          {
              Q_OBJECT
          private:
              QLabel *label;
              QLabel *label1;
              QLabel *label2;
              QPushButton *ok_1;
              QPushButton *close_1;
              QLineEdit *LineEdit_1;
              QFrame *line_1;
          public:
              dialog(char answer,QWidget *parent=0);
          private slots:
              void ok_clicked(char asnwer);
              void ok_enabled(QString);
          };
          
          dialog::dialog(char answer,QWidget):public QDialog //constructor
          

          like this i have two errors

          1. prototype for 'dialog::dialog(char, QWidget)' does not match any in class 'dialog'
            dialog::dialog(char answer,QWidget):public QDialog
            ^
            2)candidates are: dialog::dialog(dialog&&)
            class dialog:public QDialog
            ^
          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @Eugene404
          spot the difference ;)

          dialog(char answer,QWidget *parent=0)
          
          dialog::dialog(char answer,QWidget)
          

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          E 1 Reply Last reply
          1
          • raven-worxR raven-worx

            @Eugene404
            spot the difference ;)

            dialog(char answer,QWidget *parent=0)
            
            dialog::dialog(char answer,QWidget)
            
            E Offline
            E Offline
            Eugene404
            wrote on last edited by
            #5

            @raven-worx

            dialog(char answer,QWidget *parent=0)
            dialog::dialog(char answer,QWidget *parent=0)
            

            like this ?

            raven-worxR 1 Reply Last reply
            0
            • E Eugene404

              @raven-worx

              dialog(char answer,QWidget *parent=0)
              dialog::dialog(char answer,QWidget *parent=0)
              

              like this ?

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @Eugene404
              almost :)
              in the definition default parameters are not allowed. But yes, the missing pointer was what i meant.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              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