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 7057441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:59:11+00:00 2026-05-28T03:59:11+00:00

I’m a student programmer and I am using Qt to build a GUI application.

  • 0

I’m a student programmer and I am using Qt to build a GUI application. I’m trying to ensure that some check boxes are checked in order to proceed. These check boxes enable or disable the group box itself and are part of the QGroupBox class. Accepted combinations could be either or both. The problem I am running into is getting the boolean value(at least that’s what I think it is) from the QGroupBox member function QGroupBox::setChecked(bool) and use it to determine whether or not to display an error message. I have tried several methods and reference Qts documentation hoping for a good example. Because the QGroupBox I’m trying to use is a member of my ui class I tried creating a new instance of QGroupBox and setting it to the values of the ui. Then; using an if statement, find out whether or not the boxes are check or not. Here’s my code for this:

QGroupBox activeParticleInjection = ui->groupBoxParticleInjection;
    QGroupBox activeFluidInjection = ui->groupBoxFluidInjection;
    if (activeParticleInjection::setChecked(false) && activeFluidInjection(false));
    {
        QMessageBox noInjectionSelectedError;
        noInjectionSelectedError.setText("Error: No injection type selected");
        noInjectionSelectedError.exec();
    }
    else
    {
        transData.particleInjectionActive = activeParticleInjection::setChecked();
        transData.fluidInjectionActive = activeFluidInjection::setChecked();

Compile and code

This doesn’t work; starting with the way I’m trying to pass the Ui properties to the new instance of QGroupBox. I know that is question is relatively generic question but I tried passing the ui checkbox directly and that caused even more issues. I looked through the documentation and that led me to the way im trying to do it know; with no luck. I was hoping for some feedback on a better method of handling QGroupBox. Being a student sometimes its hard to see the answer especially when dealing with such unique members as the ones put together in QT.

Prior to changes I was using this method to build this process; and I received errors for the way my if parameters were setup. Compile error was : no matching function for call to ‘QGroupBox::isChecked(bool)’

if (ui->groupBoxFluidInjection->isChecked(false) && ui->groupBoxParticleInjection->isChecked(false));
    {
        QMessageBox noInjectionSelectedError;
        noInjectionSelectedError.setText("Error: No injection type selected");
        noInjectionSelectedError.exec();
    }
    else
    {
        transData.particleInjectionActive = ui->groupBoxParticleInjection->isChecked();
        transData.fluidInjectionActive = ui->groupBoxFluidInjection->isChecked();
    }

I have been using these sites for most help:
QGroupBox
QCheckBox

  • 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-28T03:59:12+00:00Added an answer on May 28, 2026 at 3:59 am

    You’re mixing several things:

    • The QGroupBox instances in ui are pointers, so you must assign them to a QGroupBox* (pointer), not a QGroupBox (object on the stack).
    • :: is used with methods only if the method you call is static (class method), which is not the case here.
    • setChecked() is a setter setting the checked state of the group box. It doesn’t return anything (void), so you cannot use them as conditions. What you want there is the getter bool QGroupBox::isChecked().

    Your code snippet cleansed:

    QGroupBox* activeParticleInjection = ui->groupBoxParticleInjection;
    QGroupBox* activeFluidInjection = ui->groupBoxFluidInjection;
    if (!activeParticleInjection->isChecked() && !activeFluidInjection->isChecked())
    {
        QMessageBox::critical(this, tr("Error"), tr("No injection type selected"));
    }
    else 
    {
        transData.particleInjectionActive = activeParticleInjection->isChecked();
        transData.fluidInjectionActive = activeFluidInjection->isChecked();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.