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. TextEdit - Vertical Scroll Bar - Disconnect all signals from scroll bar slots
Qt 6.11 is out! See what's new in the release blog

TextEdit - Vertical Scroll Bar - Disconnect all signals from scroll bar slots

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 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.
  • K Offline
    K Offline
    Klondike6
    wrote on last edited by
    #1

    I am using a TextEdit widget but I need to control it's vertical scroll bar directly. I don't want the TextEdit widget to do anything with the vertical scroll bar. Is there a way to disconnect all signals from the scroll bar slots?

    I've looked at the "disconnect" documentation, but this disconnects everything connected to an objects signals. Therefore the following disconnects all signals emitted by the scroll bar, but I want to disconnect all signals connected to the slots on the scroll bar:
    [code]
    disconnect(ui->textEdit->verticalScrollBar(), 0, 0, 0);
    [/code]

    The disconnect method cannot be used with the '0' wildcard for the Sender, so I cannot do the following:
    [code]
    disconnect(0, 0, ui->textEdit->verticalScrollBar(), 0);
    [/code]

    If I know what to use as the sender, then I could do something like this:
    [code]
    disconnect(sender, 0, ui->textEdit->verticalScrollBar(), 0);
    [/code]

    Thanks for any guidance you can provide.

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

      You could simply hide the default vertical scroll bar using
      @
      widget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      @
      and then put your own manually instantiated scroll bar in its place.

      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
      • K Offline
        K Offline
        Klondike6
        wrote on last edited by
        #3

        True, but this brings up another question.

        I use a Dock widget, with the TextEdit widget inside of it, so that the TextEdit is resized as the user resizes the window.
        [code]
        ui->dockWidget->setWidget(ui->textEdit);
        [/code]

        I couldn't see a way to have two widgets (TextEdit and separate vertical scroll bar) in the Dock widget so that both resized with the window. Do you know a way to do this?

        Thanks again.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          You could just put them both inside another widget, and put them in a layout together...

          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