Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8428861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:10:24+00:00 2026-06-10T05:10:24+00:00

Is there anyway to add like a button in qtablewidget? But the date within

  • 0

Is there anyway to add like a button in qtablewidget? But the date within the cell would stil have to be displaying, for example if an user double clicked a cell, could i send a signal like a button? Thanks!

edititem():

def editItem(self,clicked):
    if clicked.row() == 0:
        #go to tab1
    if clicked.row() == 1:
        #go to tab1
    if clicked.row() == 2:
        #go to tab1
    if clicked.row() == 3:
        #go to tab1

table trigger:

self.table1.itemDoubleClicked.connect(self.editItem)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:10:26+00:00Added an answer on June 10, 2026 at 5:10 am

    You have a couple of questions rolled into one…short answer, yes, you can add a button to a QTableWidget – you can add any widget to the table widget by calling setCellWidget:

    # initialize a table somehow
    table = QTableWidget(parent)
    table.setRowCount(1)
    table.setColumnCount(1)
    
    # create an cell widget
    btn = QPushButton(table)
    btn.setText('12/1/12')
    table.setCellWidget(0, 0, btn)
    

    But that doesn’t sound like what you actually want.

    It sounds like you want to react to a user double-clicking one of your cells, as though they clicked a button, presumably to bring up a dialog or editor or something.

    If that is the case, all you really need to do is connect to the itemDoubleClicked signal from the QTableWidget, like so:

    def editItem(item):
        print 'editing', item.text()    
    
    # initialize a table widget somehow
    table = QTableWidget(parent)
    table.setRowCount(1)
    table.setColumnCount(1)
    
    # create an item
    item = QTableWidgetItem('12/1/12')
    table.setItem(0, 0, item)
    
    # if you don't want to allow in-table editing, either disable the table like:
    table.setEditTriggers( QTableWidget.NoEditTriggers )
    
    # or specifically for this item
    item.setFlags( item.flags() ^ Qt.ItemIsEditable)
    
    # create a connection to the double click event
    table.itemDoubleClicked.connect(editItem)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to customize will_paginate control button to add more button like
I'm trying to add a Like and Send button to me site, but when
Is there anyway we can add the tomcat eclipse plugin to Adobe Flex Builder
i have structure like this <table><tr><td></td><td><input type=button name=button></td></tr></table> <script> $('tr').click(function(){window.alert('tr');}) $(':input').click(function(){window.alert('input');}) </script> when i
OK so I have this applet thats like this BorderLayout.CENTER - (Within this is
I have a button that uses a stretchable PNG as the background image, like
I have an html table followed by a button that says Add Row below
Hello friends, I want to add a custom button on my searching string like
I would like to have a JRadioPanel with three options. The first two are
when i try to add to my website a FB Like Button with url+hash

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.