Skip to content
QtWS25 Last Chance
  • 0 Votes
    6 Posts
    614 Views
    Pl45m4P
    @Christian-Ehrlicher said in Widget from scratch using pImpl, how to Q_PRIVATE_SLOT?: As I said the pmf syntax needs a QObject as sender and receiver. Ah sorry, while I was editing my example code I missed your reply :) Oh wow didn't know that :0 So the ( SIGNAL(), SLOT() ) connection stuff is not 100% identical in terms of use-case and compatibility with the Functor-based connections? Good to know. @Christian-Ehrlicher said in Widget from scratch using pImpl, how to Q_PRIVATE_SLOT?: Maybe you can also take a look on QObjectPrivate::connect() in qobject_p.h (when someone asks - I don't know this function... 🙂) Yeah, I checked the Qt Private sources here and there while I was building my widget to see how it's done. Haven't seen this exact part, but will visit it again ;-) Since I don't want to include the Qt Private source completely (which would make my widget highly dependent on a single Qt version), I made my own WidgetPrivate based on QWidgetPrivate "style" but without inheriting it... so no QObjectData, QObjectPrivate and whatnot... for me ;-) Edit: @Christian-Ehrlicher said in Widget from scratch using pImpl, how to Q_PRIVATE_SLOT?: Maybe you can also take a look on QObjectPrivate::connect() in qobject_p.h (when someone asks - I don't know this function... 🙂) This function? What is there to see? Other than QObjectPrivate::connect. You mean the use of two QObject Functors? when someone asks - I don't know this function Nobody will know 🤐 One way is to derive the private class from QObject or use a lambda. If one way to make it work is using the SIGNAL / SLOT keywords again, I will probably try it. Tried lambda, did not work either :/ Or maybe I was doing something wrong. Edit_II: I made my actual code work, using String-based connections while I moved the connect statement to the WidgetPrivate::init() function and hid the QTimer also behind the WidgetPrivate data. Not 100% pleased, tho :D Is it a good idea to make the Impl class a QObject?! What's your recommendation? @SGaist oh lol even missed your comment too :D Was about to add the code anyway :)