Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qcheckbox

    Log in to post
    • All categories
    • S

      Unsolved QCheckBox and QRadioButton not displaying boxes or marks
      General and Desktop • qt6 checkboxq qcheckbox • • swurl

      6
      0
      Votes
      6
      Posts
      117
      Views

      S

      @ChrisW67 It did not. I ended up reinstalling Linux and that seems to have fixed it. I still have the old install available so I'd like to find out the root cause still.

    • A

      Solved Add QCheckBox in every cells of a column in QTable Widget
      General and Desktop • qtablewidget qcheckbox • • aim0d

      3
      0
      Votes
      3
      Posts
      297
      Views

      A

      @Christian-Ehrlicher Oh, so stupid of mine for not thinking about it ahha
      thanks!

      RESULT for future noobie like me:

      for(int row=0;row<=12;row++){ QHBoxLayout *a = new QHBoxLayout(); a->addWidget((new QCheckBox(""))); QWidget *z = new QWidget(); z->setLayout(a); ui->tableWidget->setCellWidget(row,0, z); }
    • D

      Unsolved QMenuBar does not show action checkbox
      General and Desktop • qmenubar qcheckbox qaction • • Dariusz

      4
      0
      Votes
      4
      Posts
      228
      Views

      SGaist

      If this is reproducible with C++, then C++ since the Python bindings are built on top of it.

    • EagleSparrow

      Unsolved Custom QCheckbox in QT widgets
      General and Desktop • qtwidgets qcheckbox stylesheet qtablewidget • • EagleSparrow

      3
      0
      Votes
      3
      Posts
      418
      Views

      EagleSparrow

      Here is the code.

      QList<SomeClass> ModeTableEntries ; for (int row = 0; row < ModeTableEntries .length(); row++) { ui->EntriesTableWidget->insertRow(row); ui->EntriesTableWidget->setRowHeight(row, 45); ModeValues value = ModeTableEntries [row]; QTableWidgetItem* currentItem = new QTableWidgetItem(value .ModeText); if(TestModeEnabled == true) currentItem->setCheckState(Qt::Checked); else currentItem->setCheckState(Qt::Unchecked); ui->EntriesTableWidget->setItem( row, 0, currentItem); currentItem->setFlags(currentItem->flags()^(Qt::ItemIsEditable )); }

      The problem is that I cannot style the default implementation of the QTableWidgetItem(QCheckbox) that is part of the QTableWidgetItem.

    • S

      Solved QCheckbox overlap with Table item value
      General and Desktop • qcheckbox delegate delegatemodel qstandarditem qtableview • • sayan275

      3
      0
      Votes
      3
      Posts
      278
      Views

      S

      @VRonin Thanks.
      It worked.
      We have used delegates because we have combobox, lineedit also.
      So we have put check for combobox, not to update via delegate.

    • V

      Unsolved QComboBox with checkable items: issue with single checked item
      General and Desktop • qcombobox qcheckbox • • voltron

      3
      0
      Votes
      3
      Posts
      651
      Views

      ptstream

      I think I have found a solution that is not necessarily complete (e.g. drive the combbox with keyboard).

      I add a boolean (e.g. mSkipToogle=false) at the same place than mSkipHide.

      I rewrite eventFilter (QObject* object, QEvent* event).

      bool CFilterCountryComboBox::eventFilter (QObject* object, QEvent* event) { QEvent::Type type = event->type (); if (object == view ()->viewport ()) { switch (type) { case QEvent::MouseButtonRelease : case QEvent::MouseButtonPress : mSkipHide = true; mSkipToogle = false; break; case QEvent::Hide : case QEvent::Show : mSkipToogle = true; break; default : break; } } if (type == QEvent::MouseButtonRelease && static_cast<QMouseEvent*>(event)->button () == Qt::RightButton) { return true; } return QComboBox::eventFilter (object, event); } Now rewrite toggleItemCheckState (int index) void CFilterCountryComboBox::toggleItemCheckState (int index) { if (!mSkipToogle) { QVariant value = itemData (index, Qt::CheckStateRole); Qt::CheckState state = static_cast<Qt::CheckState>(value.toInt ()); setItemData (index, (state == Qt::Unchecked ? Qt::Checked : Qt::Unchecked), Qt::CheckStateRole); } else { mSkipToogle = false; } }

      It seems to work on Windows with Qt 5.12.7.
      Good luck

    • pauledd

      Solved change disabled background color QCheckbox?
      General and Desktop • qcheckbox background color • • pauledd

      4
      0
      Votes
      4
      Posts
      2118
      Views

      JonB

      @pauledd
      You mean the background color "overspill" to right & bottom? I don't know but you might play with border-... or padding-... (I'm thinking margin- does not use background color, but I might be wrong) having a width/transparency/grey....

    • L

      Unsolved Problem with the QCheckBox
      General and Desktop • qcheckbox state • • letinas

      4
      0
      Votes
      4
      Posts
      718
      Views

      SGaist

      What does condition contain ?

    • Y

      Solved How to add the check box with item, and Checkbox should check by the user.
      General and Desktop • qcheckbox qmodelidex qstandarditem qstandarditemmo qsortfilterprox • • Yash001

      5
      0
      Votes
      5
      Posts
      2054
      Views

      Y

      Thank you @mrjj and @Christian for answer. I am able to make user Checkable.

      class CustomListModel : public QStandardItemModel {
      public:
      Qt::ItemFlags CustomListModel::flags(const QModelIndex & index) const {
      Qt::ItemFlags defaultFlags = QStandardItemModel::flags(index);
      if (index.isValid()) {
      return defaultFlags | Qt::ItemIsUserCheckable;
      }
      return defaultFlags;
      }

      CustomListModel(const int row, const int coloumn) : QStandardItemModel(row, coloumn) { }

      };

      and modification.
      hwListProxyModel->setSourceModel(new CustomListModel (0, 0));

    • S

      Solved qcheckbox SLOT doesnot get called on clicked
      General and Desktop • qcheckbox signal & slot • • Sumit

      12
      0
      Votes
      12
      Posts
      2643
      Views

      Pradeep Kumar

      @Sumit

      Glad u got the result,
      Happy Coding,

      Thanks,

    • CybeX

      Solved QCheckBox not displaying checked state
      General and Desktop • qt 5.7 qcheckbox signals&slots gui • • CybeX

      4
      0
      Votes
      4
      Posts
      4620
      Views

      CybeX

      Here is a possible solution for solving this "missing check/mark" issue.

      I implemented the CSS "indicator" solution I got from this qt form post which is problematic.

      Sources of solution:

      Doc page: here Implementation: here QPalette p = ui->checkBox->palette(); p.setColor(QPalette::Active, QPalette::Base, QColor(255, 255, 255)); p.setColor(QPalette::Button, QColor(255, 255, 255)); ui->checkBox->setAutoFillBackground(true); ui->checkBox->setPalette(p); QColor(255, 255, 255)

      refers to your desired background color, possibly the same color as your window background, etc.

      QPallete::Active, QPalette::base

      refers to the active checkbox's background (the white box background)

      QPalette::Button

      refers to the "actual background" (behind the checkbox and the checkbox text)

      Hope this helps!

    • _

      Unsolved How to sub stylesheet ?
      General and Desktop • qcombobox qlistview qcheckbox qstyle stylesheet • • _compiler

      5
      0
      Votes
      5
      Posts
      2228
      Views

      _

      @_compiler said:

      thanks.

    • H

      Unsolved Clickable QCheckBox how to?
      General and Desktop • qcheckbox qradiobutton qt5.5.1 • • HPCTECH

      6
      0
      Votes
      6
      Posts
      2983
      Views

      D

      QCheckBox inherits from QAbstractButton, which provides a hitButton method that controls which parts of the button are clickable. All you need to do is make a new subclass of QCheckBox and override hitButton so it always returns true:

      class BigHitCheckBox : public QCheckBox { bool hitButton(const QPoint & pos) const override { Q_UNUSED(pos); return true; } };

      This is much simpler than the solutions previously mentioned, and it should play well with the hovering, disabling, and tristate features of the checkbox without any extra effort.

      By the way, this makes the entire checkbox widget clickable, but it doesn't make other widgets outside the checkbox clickable. I don't think the OP needed that.

      --David

    • J

      Solved Can I make the QCheckBox label clickable?
      General and Desktop • qcheckbox mousepressevent • • Jakob

      3
      0
      Votes
      3
      Posts
      1502
      Views

      J

      Nevermind - in the end it turned out the label was modeled as a separate QLabel instead of the text of the QCheckBox. Once I removed the label, and put the text inside the checkbox, I got exactly what I was asking for.

    • R

      Validating a multiple checkboes
      Mobile and Embedded • qcheckbox • • Rohith

      3
      0
      Votes
      3
      Posts
      1095
      Views

      N

      I am not really sure what you want to do, but maybe a QButtonGroup could be helpful?