Results 1 to 9 of 9

Thread: QPushButton Requires Two Clicks (Not Always)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPushButton Requires Two Clicks (Not Always)

    Yes, I have this problem too, if i put the btn to layout, i must clicked twitce; if don't use QVBoxLayout it's work

    But, If i set tabWidget is documentMode, It is work.

    my system is OSX 10.15.6, Qt: 5.15

    #include "preferencewidget.h"
    #include "ui_preferencewidget.h"
    #include <QTabWidget>
    #include <QPushButton>
    #include <QDebug>
    #include <QLayout>
    #include <QVBoxLayout>

    PreferenceWidget::PreferenceWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PreferenceWidget)
    {
    ui->setupUi(this);

    QTabWidget *tab = new QTabWidget(this);

    QWidget *browser_tab = new QWidget;
    QWidget *users_tab = new QWidget;

    tab->addTab(browser_tab, "Browser");
    tab->addTab(users_tab, "Users");

    tab->setGeometry(20, 20, 300, 250);

    QPushButton *btn = new QPushButton("Btn1");
    btn->setGeometry(10, 30, 100, 40);
    btn->setParent(users_tab);

    QVBoxLayout *vl = new QVBoxLayout(users_tab);
    vl->addWidget(btn);
    users_tab->setLayout(vl);


    connect(btn, SIGNAL(clicked()), this, SLOT(clickedAlert()));
    }

    PreferenceWidget::~PreferenceWidget()
    {
    delete ui;
    }


    void PreferenceWidget::clickedAlert()
    {
    qDebug() << "Clicked";
    }
    Last edited by kyosold; 25th August 2020 at 11:04.

Similar Threads

  1. Replies: 3
    Last Post: 2nd November 2017, 23:03
  2. Expanded QComboBox Prevents QPushButton Clicks
    By sean8051 in forum Qt Programming
    Replies: 1
    Last Post: 9th September 2016, 19:04
  3. Replies: 3
    Last Post: 8th August 2016, 13:20
  4. QPushButton,Several unclicked clicks too many
    By thefatladysingsopera in forum Newbie
    Replies: 6
    Last Post: 16th August 2011, 09:51
  5. Replies: 2
    Last Post: 20th December 2010, 17:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.