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. Connection signals/slots of a sublcass

Connection signals/slots of a sublcass

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 661 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.
  • C Offline
    C Offline
    cuddlykittens11
    wrote on last edited by
    #1

    I'm working on a project where there is this interface called "ColorChooser." It is an abstract baseclass, with a signal "colorChanged," that is used to notify that the color the user has entered into the widget has changed. For example, I have a few sublcasses called "RGBWheel," and "HSVWheel," that implement the interface.

    Now, for some reason when I connect the signals and slots like in the first block the slot isn't being picked up on the signal emission. Yet If I connect them like in the second block, the slot does pickup on the signal
    @
    // Doesn't work
    ColorChooser *cc = new RGBWheel(this);
    connect(cc, &ColorChooser::colorChanged, app, &App::onColorChanged);

    // But this does
    connect((RGBWheel *)cc, &RGBWheel::colorChanged, app, &App::onColorChanged);
    @

    Can someone explain to me what I might be doing wrong here where I can't use the first method? Or is it completely impossible to connect signals/slots in that manner?

    EDIT: fixed issue, see below.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cuddlykittens11
      wrote on last edited by
      #2

      My Bad,

      Accidentally redeclared in the "colorChanged," signal in the RGBWheel class delcration.

      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