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. How to use QOverload "directly" ?
Qt 6.11 is out! See what's new in the release blog

How to use QOverload "directly" ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 467 Views 2 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    The attached code fails in C11 .
    I am supposedly be able to use QOverload directly.
    I cannot find an example of such syntax.

    Could somebody rewrite the attached code to do so ?
    Or a link to "tutorial" ?

    connect(list_widget_1,
            &QListWidget::itemClicked,
            list_widget_2,
            QOverload<QListWidgetItem*>::of(&QListWidget::addItem));
    
    JKSHJ 1 Reply Last reply
    0
    • A Anonymous_Banned275

      The attached code fails in C11 .
      I am supposedly be able to use QOverload directly.
      I cannot find an example of such syntax.

      Could somebody rewrite the attached code to do so ?
      Or a link to "tutorial" ?

      connect(list_widget_1,
              &QListWidget::itemClicked,
              list_widget_2,
              QOverload<QListWidgetItem*>::of(&QListWidget::addItem));
      
      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @AnneRanch said in How to use QOverload "directly" ?:

      The attached code fails in C11 .

      Your usage of QOverload looks correct. This code compiles with no problems for me, on MinGW 7.3.0 32-bit and MSVC 2019 32-bit:

      auto list_widget_1 = new QListWidget;
      auto list_widget_2 = new QListWidget;
      
      connect(list_widget_1,
              &QListWidget::itemClicked,
              list_widget_2,
              QOverload<QListWidgetItem*>::of(&QListWidget::addItem));
      

      So, your issue is not in the syntax, but somewhere else.

      Please post the error message that you received and the section of your code that initializes list_widget_1 and list_widget_2. Please also provide your version of Qt and your compiler.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      2
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Already asked here: https://forum.qt.io/topic/121355 - you need to use a proper compiler which understand c++11.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved