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. A few questions on Qt

A few questions on Qt

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.3k Views
  • 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.
  • W Offline
    W Offline
    wonopon12
    wrote on last edited by
    #1

    Hey everyone, I had a few questions I was wondering if anyone could answer :D Thanks for your help guys!

    1. How can you open a text document with Notepad? (I don't mean with QFile or QTextStream)

    2. How can you open a new window from pressing a button on your QMainWindow? (I want to open a About the program window by pressing a button on my QMainWindow)

    3. How do you make QFileDialog only work with files?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Ad. 1. Certainly no cross-platform way of doing that. I don't use Windows, but I guess it would involve running something like "notepad fileToOpen.txt" in the terminal (console). In Qt, you can do that with QProcess.

      Ad. 2. Connect button's clicked() signal to a slot of your choice. In the slot, run:
      @
      QMessageBox::aboutQt(parent, title);
      @
      This can also be done in many other ways.

      Ad. 3. What do you mean by "work with files"? You mean you want to display only files? That would be strange. Anyway, what you probably need is to look into static members of QFileDialog (::getOpenFileName(), ::getOpenFileNames() etc.), or/ and the QFileDialog::FileMode flag.

      (Z(:^

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wonopon12
        wrote on last edited by
        #3

        Thanks for your reply. For the 2nd question, I meant with a already created *.ui file, not with a QMessageBox. Thanks!

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          The procedure is very similar. You have to include the UI header, initialise the object somewhere in your code (e.g. in main window's constructor. This, again, can be done in many ways). Next, connect button's signal to your slot, and there call:
          @
          myNewWindow->show();
          @

          (Z(:^

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nani2000
            wrote on last edited by
            #5

            I am beginner to QT and have a question, I am not sure If I am posting in correct place. Please try to help me with this,

            My Question: ScrollView {
            style: ScrollviewStye{}
            ColumnLayout {
            ''''''''
            }
            }
            Scrollview works fine(i.e. Iam able to move scrollbar with mouse) but scrollbar doesnot react to up and down arrow keys with keyboard.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              Nani2000
              wrote on last edited by
              #6

              I am beginner to QT and have a question, I am not sure If I am posting in correct place. Please try to help me with this,

              My Question: ScrollView {
              style: ScrollviewStye{}
              ColumnLayout {
              ''''''''
              }
              }
              Scrollview works fine(i.e. Iam able to move scrollbar with mouse) but scrollbar doesnot react to up and down arrow keys with keyboard.

              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