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. QTableWidget onCurrentItemChanged(QTableWidgetItem *cur, QTableWidgetItem *prev),When program started, prev is null
Forum Updated to NodeBB v4.3 + New Features

QTableWidget onCurrentItemChanged(QTableWidgetItem *cur, QTableWidgetItem *prev),When program started, prev is null

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 283 Views
  • 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.
  • echo_lovelyE Offline
    echo_lovelyE Offline
    echo_lovely
    wrote on last edited by
    #1
    • Environment
    1. OS: Ubuntu 20.04
    2. Qt -version 5.12.8
    QTableWidget onCurrentItemChanged(QTableWidgetItem *cur, QTableWidgetItem *prev),
    When program frist starts, the address of prev is 0x0,how to handle with the problem?
    

    1b0c0f13-5663-4b38-a2d8-da4702d87949-dd2b884c6fad096832dcb627a09202f.jpg

    QAQ

    JonBJ 1 Reply Last reply
    0
    • echo_lovelyE Offline
      echo_lovelyE Offline
      echo_lovely
      wrote on last edited by
      #2

      0x0 looks lile a wronged person or bear! ahaha

      1 Reply Last reply
      0
      • echo_lovelyE echo_lovely
        • Environment
        1. OS: Ubuntu 20.04
        2. Qt -version 5.12.8
        QTableWidget onCurrentItemChanged(QTableWidgetItem *cur, QTableWidgetItem *prev),
        When program frist starts, the address of prev is 0x0,how to handle with the problem?
        

        1b0c0f13-5663-4b38-a2d8-da4702d87949-dd2b884c6fad096832dcb627a09202f.jpg

        QAQ

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by JonB
        #3

        @echo_lovely
        There is no "problem". First time it is called you are (presumably) changing from no current item (0x0, nullptr) to some current item. Perfectly reasonable? So do not try to access prev->... if prev == nullptr.

        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