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] How to hide/show things with a certain widget, and how to show output of terminal in a window?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to hide/show things with a certain widget, and how to show output of terminal in a window?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 5.3k 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    So 1st question is what is this widget?

    !http://i.imgur.com/eiHOL.png(widget)!

    it can hide and show things, it looks very cool.. i could sure hide and show things with a button saying "Details", but i wouldn't be able to have an arrow showing right when hidden and down when visible.. plus a button would be ugly..

    [SOLVED]
    and the 2nd question is how to show output of terminal in a window.. like this:

    !http://i.imgur.com/2Y9Vq.png(widget2)!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leon
      wrote on last edited by
      #2

      Anyone? At least for the 1st question?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mlong
        wrote on last edited by
        #3

        You could use a QCheckBox and change the indicator using a style sheet, I suppose.

        See "here":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qcheckbox for an example.

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DerManu
          wrote on last edited by
          #4

          About the terminal thing:
          Do you want an application-terminal so your application can print some information and receive commands from the user or do you want actual terminal cout/cin with another process?

          If you only want the first, subclass QTextEdit, set the styles accordingly (black background, white text, monospaced font, etc.) and reimplement the key events to allow typing only at the very last line after some prompt, e.g. "/home/leon/$". Further you should add some signals/slots for typical terminal jobs: signal executeCommand(QString) when the user hits return after typing something, slot print(QString) to print a line, slot prompt() to create a new prompt after printing some lines.

          If you want inter-process-communication via cin/cout stream, look at QProcess. You can use it like any of the other QIODevices (e.g. QTcpSocket), read the other processes' cout and append it into a terminal-style text edit as described above.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leon
            wrote on last edited by
            #5

            [quote author="mlong" date="1344956843"]You could use a QCheckBox and change the indicator using a style sheet, I suppose.

            See "here":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qcheckbox for an example.[/quote]

            so this works for me
            @ ui->checkBox->setStyleSheet("QCheckBox::indicator:unchecked {image: url(:/icons/Pictures/unchecked.png);}");
            @

            but what about the image? How can all programms on ubuntu have the same right/down arrow.. where can i find this icon in ubuntu?

            Could i use a QIconfromtheme? if yes which one and how should i modify the above code?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Leon
              wrote on last edited by
              #6

              It is really a good idea! Thank you.

              [quote author="DerManu" date="1344959009"]About the terminal thing:
              Do you want an application-terminal so your application can print some information and receive commands from the user or do you want actual terminal cout/cin with another process?

              If you only want the first, subclass QTextEdit, set the styles accordingly (black background, white text, monospaced font, etc.) and reimplement the key events to allow typing only at the very last line after some prompt, e.g. "/home/leon/$". Further you should add some signals/slots for typical terminal jobs: signal executeCommand(QString) when the user hits return after typing something, slot print(QString) to print a line, slot prompt() to create a new prompt after printing some lines.

              If you want inter-process-communication via cin/cout stream, look at QProcess. You can use it like any of the other QIODevices (e.g. QTcpSocket), read the other processes' cout and append it into a terminal-style text edit as described above.[/quote]

              Anyone can answer what i said previous?

              [quote author="Leon" date="1345037007"][quote author="mlong" date="1344956843"]You could use a QCheckBox and change the indicator using a style sheet, I suppose.

              See "here":http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qcheckbox for an example.[/quote]

              so this works for me
              @ ui->checkBox->setStyleSheet("QCheckBox::indicator:unchecked {image: url(:/icons/Pictures/unchecked.png);}");
              @

              but what about the image? How can all programms on ubuntu have the same right/down arrow.. where can i find this icon in ubuntu?

              Could i use a QIconfromtheme? if yes which one and how should i modify the above code?[/quote]

              1 Reply Last reply
              0
              • JeroentjehomeJ Offline
                JeroentjehomeJ Offline
                Jeroentjehome
                wrote on last edited by
                #7

                The arrow is supplied by the OS. In win7 / Vista etc other views are given. The software will show different arrow types for every OS that it is compiled on. If you want it differently you probably need to subclass the QCheckbox and do the paint yourself.
                greetz

                Greetz, Jeroen

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  Leon
                  wrote on last edited by
                  #8

                  [quote author="Jeroentje@home" date="1345111036"]The arrow is supplied by the OS. In win7 / Vista etc other views are given. The software will show different arrow types for every OS that it is compiled on. If you want it differently you probably need to subclass the QCheckbox and do the paint yourself.
                  greetz[/quote]

                  Well u say The arrow is supplied by the OS.. i know that.. but how to do it?
                  Should i use a QIconfromtheme? if yes which one and how should i modify the above code?

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DerManu
                    wrote on last edited by
                    #9

                    It's unlikely anyone knows something so specific (where some random icon in some random program comes from) here. So you must do the research yourself. For example, you could retrieve all icons with QIcon::fromTheme (see the documentation for all possible icon names) and see if there's your arrow somewhere. Then your program looks like it's part of ubuntu and thus open source. Go find its source code and see where they get the icon from.

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      Leon
                      wrote on last edited by
                      #10

                      From here (http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html), they only icon i can see, is go-down, go-next which is not really the one i wanted ( like all the ubuntu apps are using ), but i think it might do..

                      I am kinda confused how should i change the code

                      @ui->checkBox->setStyleSheet("QCheckBox::indicator:unchecked {image: url(:/icons/Pictures/unchecked.png);}");@

                      This won't work:
                      @ui->checkBox->setStyleSheet("QCheckBox::indicator:unchecked {image: url(QIcon::fromTheme("go-down"));}");@

                      [quote author="DerManu" date="1345112055"]It's unlikely anyone knows something so specific (where some random icon in some random program comes from) here. So you must do the research yourself. For example, you could retrieve all icons with QIcon::fromTheme (see the documentation for all possible icon names) and see if there's your arrow somewhere. Then your program looks like it's part of ubuntu and thus open source. Go find its source code and see where they get the icon from.[/quote]

                      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