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

  • Home
  • SEARCH
  • 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 849077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:02:49+00:00 2026-05-15T07:02:49+00:00

I have subclassed QComboBox to customize it for special needs. The subclass is used

  • 0

I have subclassed QComboBox to customize it for special needs. The subclass is used to promote QComboBoxes in a ui file from QtDesigner. Everything works except that when I put a break point in a slot, the program does not stop at the breakpoint. I do however know that it is being called from the result it generates. I checked other slots in my program and they work fine with breakpoints. Doing a clean and rebuild all did not fix it. What could be causing this and is there anything I can do about it? The slot in question is the only one in the subclass and is called “do_indexChanged()”. You can find the slot on line 37 of the class header below and the signal-slot connection on line 10 of the class source file.
CLASS HEADER:

#ifndef WVQCOMBOBOX_H
#define WVQCOMBOBOX_H

#include <QWidget>
#include <QObject>
#include <QComboBox>
#include <QVariant>



class wvQComboBox : public QComboBox
{
Q_OBJECT
//Q_PROPERTY(bool writeEnable READ writeEnable WRITE setWriteEnable)
public:
    explicit wvQComboBox(QWidget *parent = 0);
    bool writeEnable() {
        return this->property("writeEnable").toBool();
    }
    void setWriteEnable(const bool & writeEnable){
        this->setProperty("writeEnable",writeEnable);
    }

    bool newValReady() {
        return this->property("newValReady").toBool();
    }
    void setNewValReady(const bool & newValReady){
        this->setProperty("newValReady",newValReady);
    }
    QString getNewVal();
    int getNewValIndex();



    int oldVal;  //comboBox Index before user edit began
private slots:
    void do_indexChanged(){
        this->setWriteEnable(true);
        if(oldVal!=currentIndex()){
            this->setNewValReady(true);
            oldVal=currentIndex();
        }
    }

protected:
    void focusInEvent ( QFocusEvent * event );
    //void focusOutEvent ( QFocusEvent * event );//dont need because of currentIndexChanged(int)
};

#endif // WVQCOMBOBOX_H


#include "wvqcombobox.h"

wvQComboBox::wvQComboBox(QWidget *parent) :
    QComboBox(parent)
{
    this->setWriteEnable(true);
    this->setNewValReady(false);
    oldVal=this->currentIndex();

    connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(do_indexChanged()));
}

void wvQComboBox::focusInEvent ( QFocusEvent * event ) {
    this->setWriteEnable(false);
    oldVal=this->currentIndex();
}


QString  wvQComboBox::getNewVal(){
    setNewValReady(false);
    return this->currentText();
}

int wvQComboBox::getNewValIndex(){
    setNewValReady(false);
    return this->currentIndex();
}
  • 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-05-15T07:02:50+00:00Added an answer on May 15, 2026 at 7:02 am

    I found the problem. All I needed to do was to put the function definition in the .cpp file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my foo_layout.xml file I have a subclassed RelativeLayout: <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android
I have subclassed UIView and provided my own drawRect, which works fine. However I
I have subclassed UIView, but I need to prevent the frame from changing, so
I have subclassed RazorViewEngine so I can check for Request.Browser.IsMobileDevice and add a special
I have subclassed a control in C# WinForms, and am custom drawing text in
I have subclassed UIViewController into a new class, PageViewController (I'm writing a simple book
We have subclassed the Silverlight Application class to add some additional functionality and then
I have subclassed UIView object inside a uiscrollview which displays a pdf page. I
I have subclassed a UITableViewCell and within this class I want to get it's
I have subclassed a UIView . I am adding it as a subview of

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.