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. QT Notepad tutorial
Forum Updated to NodeBB v4.3 + New Features

QT Notepad tutorial

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt creator 4.5qt 5.10.0notepad tutoria
15 Posts 4 Posters 5.5k Views 2 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.
  • R raven-worx
    7 Feb 2018, 17:35

    @SeanR
    your link doesn't point to a tutorial but to the docs of the QAction class?

    Anyway i can only tell how to do this programmatically and not with QtDesigner (since i never used it yet honestly). You need to create QAction instances and connect their triggered()-signal to custom slots. In there you do the work.
    For "new" you could call clear() on the textedit. For "open" you can open a QFileDialog, for "print" call print() on the textedit, for "exit" you could call QApplication::instance()->quit() for example.

    S Offline
    S Offline
    SeanR
    wrote on 7 Feb 2018, 20:03 last edited by
    #3

    @raven-worx
    You are correct. I copied the wrong link. Sorry that has been corrected. I copied the verbiage in the original post. You will be able to see the link now. It's very confusing. I am new to UI work and and QT. Just started about 5 hours ago.

    M 1 Reply Last reply 7 Feb 2018, 20:26
    0
    • S SeanR
      7 Feb 2018, 20:03

      @raven-worx
      You are correct. I copied the wrong link. Sorry that has been corrected. I copied the verbiage in the original post. You will be able to see the link now. It's very confusing. I am new to UI work and and QT. Just started about 5 hours ago.

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 7 Feb 2018, 20:26 last edited by
      #4

      @SeanR
      Hi,
      Creator seems not to create an action for a top menu.
      It works as sample says for sub items, but either i miss some little step in the description or
      it has changed since example was written.

      alt text

      S 1 Reply Last reply 7 Feb 2018, 20:39
      2
      • M mrjj
        7 Feb 2018, 20:26

        @SeanR
        Hi,
        Creator seems not to create an action for a top menu.
        It works as sample says for sub items, but either i miss some little step in the description or
        it has changed since example was written.

        alt text

        S Offline
        S Offline
        SeanR
        wrote on 7 Feb 2018, 20:39 last edited by
        #5

        @mrjj
        Ok, let me play it with it. I will update this post if I can get it to work.

        1 Reply Last reply
        1
        • S Offline
          S Offline
          SeanR
          wrote on 7 Feb 2018, 21:36 last edited by SeanR 2 Jul 2018, 21:37
          #6

          Ok, I see what is going on. I believe whomever wrote the guide was a little familiar with GT UI. So unfortunately, as I was not I got lost and completed the task wrong. What the guide should say is double click, "Type here" and change to "File". Then proceed to create the following items under "File".

          • New
          • Open
          • Save
          • Save as
          • Exit

          At this point the inaction items will be created for you. Unfortunately, my screen grabbing utility on Mac causes the file menu to collapse. So you can see it in the image. See example below.
          0_1518039122860_UpdatedActionEditor.png

          M 1 Reply Last reply 7 Feb 2018, 21:41
          1
          • S Offline
            S Offline
            SeanR
            wrote on 7 Feb 2018, 21:38 last edited by
            #7

            Thank you to everyone who pitched in and helped. Viewing the screen grabs and comments I was able to piece together what I was doing wrong.

            1 Reply Last reply
            1
            • S SeanR
              7 Feb 2018, 21:36

              Ok, I see what is going on. I believe whomever wrote the guide was a little familiar with GT UI. So unfortunately, as I was not I got lost and completed the task wrong. What the guide should say is double click, "Type here" and change to "File". Then proceed to create the following items under "File".

              • New
              • Open
              • Save
              • Save as
              • Exit

              At this point the inaction items will be created for you. Unfortunately, my screen grabbing utility on Mac causes the file menu to collapse. So you can see it in the image. See example below.
              0_1518039122860_UpdatedActionEditor.png

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 7 Feb 2018, 21:41 last edited by
              #8

              @SeanR
              Ah, now it all makes sense. :)
              Good work.
              Please feel free to ask about designer if you get stuck again.

              S 1 Reply Last reply 7 Feb 2018, 21:45
              1
              • M mrjj
                7 Feb 2018, 21:41

                @SeanR
                Ah, now it all makes sense. :)
                Good work.
                Please feel free to ask about designer if you get stuck again.

                S Offline
                S Offline
                SeanR
                wrote on 7 Feb 2018, 21:45 last edited by
                #9

                @mrjj I most definitely will. I have a couple of projects that I want to create for both iOS, MacOSX and Windows. I am even considering a port to Linux. I think this might be the easiest way for me to do this. So far I am really enjoying this quest.

                M 1 Reply Last reply 7 Feb 2018, 21:50
                0
                • S SeanR
                  7 Feb 2018, 21:45

                  @mrjj I most definitely will. I have a couple of projects that I want to create for both iOS, MacOSX and Windows. I am even considering a port to Linux. I think this might be the easiest way for me to do this. So far I am really enjoying this quest.

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 7 Feb 2018, 21:50 last edited by mrjj 2 Jul 2018, 21:51
                  #10

                  @SeanR
                  Yes, Qt will help a loooong way making the app cross platform.
                  Depending on what features you use, it might be a simple recompile and its running.
                  Note that using virtual machines for each platform is often far less work then
                  setting up cross compiling from one platform to the others.

                  One note. When you use Designer, c++ code is generated for you.
                  If you press F2 on ui->setupUi(this); in mainwindow constructor you can see
                  how the UI is being created. This i found useful for understanding how stuff worked.
                  Also if you add widgets dynamically to a Designer created class/form, always
                  put it UNDER that line :)

                  S 1 Reply Last reply 8 Feb 2018, 03:58
                  0
                  • M mrjj
                    7 Feb 2018, 21:50

                    @SeanR
                    Yes, Qt will help a loooong way making the app cross platform.
                    Depending on what features you use, it might be a simple recompile and its running.
                    Note that using virtual machines for each platform is often far less work then
                    setting up cross compiling from one platform to the others.

                    One note. When you use Designer, c++ code is generated for you.
                    If you press F2 on ui->setupUi(this); in mainwindow constructor you can see
                    how the UI is being created. This i found useful for understanding how stuff worked.
                    Also if you add widgets dynamically to a Designer created class/form, always
                    put it UNDER that line :)

                    S Offline
                    S Offline
                    SeanR
                    wrote on 8 Feb 2018, 03:58 last edited by
                    #11

                    @mrjj
                    Right now I am trying to track down where to put the declarations of the inaction stuff. In my first project it was Class / private ....

                    How do I clear out an old project?

                    S 1 Reply Last reply 8 Feb 2018, 04:31
                    0
                    • S SeanR
                      8 Feb 2018, 03:58

                      @mrjj
                      Right now I am trying to track down where to put the declarations of the inaction stuff. In my first project it was Class / private ....

                      How do I clear out an old project?

                      S Offline
                      S Offline
                      SeanR
                      wrote on 8 Feb 2018, 04:31 last edited by
                      #12

                      @SeanR said in QT Notepad tutorial:

                      @mrjj
                      Right now I am trying to track down where to put the declarations of the inaction stuff. In my first project it was Class / private ....

                      How do I clear out an old project?

                      Actually, I reset the project and started over. My old project was busted. The answer to my question was "private slot:"

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SeanR
                        wrote on 8 Feb 2018, 05:41 last edited by
                        #13

                        Ok, so here is my next question. I have finally got the application semi working. I have an issue though. Please ignore the missing icons. I was just doing it for a test type thing.

                        Why does my application not have a "File" & "Edit" menu??
                        Yes, I can drag the icons out. But I really liked the fact the tutorial can have a file menu.

                        0_1518068427667_Notepad_Ui.png

                        J 1 Reply Last reply 8 Feb 2018, 05:43
                        0
                        • S SeanR
                          8 Feb 2018, 05:41

                          Ok, so here is my next question. I have finally got the application semi working. I have an issue though. Please ignore the missing icons. I was just doing it for a test type thing.

                          Why does my application not have a "File" & "Edit" menu??
                          Yes, I can drag the icons out. But I really liked the fact the tutorial can have a file menu.

                          0_1518068427667_Notepad_Ui.png

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 8 Feb 2018, 05:43 last edited by
                          #14

                          @SeanR Isn't the application menu on the top bar in MacOS and not in the application window itself?

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          S 1 Reply Last reply 8 Feb 2018, 14:15
                          4
                          • J jsulm
                            8 Feb 2018, 05:43

                            @SeanR Isn't the application menu on the top bar in MacOS and not in the application window itself?

                            S Offline
                            S Offline
                            SeanR
                            wrote on 8 Feb 2018, 14:15 last edited by
                            #15

                            @jsulm said in QT Notepad tutorial:

                            @SeanR Isn't the application menu on the top bar in MacOS and not in the application window itself?

                            Good call. I being mostly a MacDev noob and tired failed to look up there. Ty, I was expecting to see on the application. Minus 50 dragon kill points for me...

                            1 Reply Last reply
                            0

                            12/15

                            8 Feb 2018, 04:31

                            • Login

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