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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:15:53+00:00 2026-06-05T00:15:53+00:00

I have a numeric editor that extends the QSpinBox NumericEditor::NumericEditor(QWidget *widget): QSpinBox(widget) I use

  • 0

I have a numeric editor that extends the QSpinBox

NumericEditor::NumericEditor(QWidget *widget): QSpinBox(widget)

I use this editor to edit the type QVariant::Int in the QTableWidget

QItemEditorCreatorBase *numericEditor = new QStandardItemEditorCreator<NumericEditor>();
factory->registerEditor(QVariant::Int, numericEditor); 

Data is entered in the table as normal. Ignore the usage of the word “color”. Its based off the color editor example.

QTableWidgetItem *nameItem2 = new QTableWidgetItem(QString("label2"));
QTableWidgetItem *colorItem2 = new QTableWidgetItem();
colorItem2->setData(Qt::DisplayRole, QVariant(int(4)));
table->setItem(1, 0, nameItem2);
table->setItem(1, 1, colorItem2);

The spin box appears and works fine in the QTableWidget.

My desire is to get access to the instance of QSpinBox that the table uses when it edits QVariant::Int cells so I can set the min and max values.

How can I do this?

  • 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-05T00:15:56+00:00Added an answer on June 5, 2026 at 12:15 am

    You can install a delegate on the column with QTableWidget::setItemDelegateForColumn, and when an editor is opened, its createEditor method will be called.

    class MyDelegate : public QStyledItemDelegate {
    public:
        QWidget *createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const {
            // You could create the widget from scratch or call 
            // the base function which will use the QItemEditor you already wrote
            QWidget * editor = QStyledItemDelegate::createEditor(parent, option, index);
    
            // do whatever you need to do with the widget
            editor->setProperty("minimum", 100);
            editor->setProperty("maximum", 100);
    
            return editor;
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within Java code it is possible to have numeric literals that use a suffix
In my JTable, I have two editable numeric columns. The editor for both columns
I have a numeric vector, it contains patches of elements that are repeating, something
I have a dataframe with numeric entries like this one test <- data.frame(x =
I have a table that has a certain numeric column called Score . I
I have a numeric value that I wish to be converted to a more
I have three numeric values (weight, count, contribution) for various strings (words) that i
I have a numeric.xml file in my project's values directory that holds most of
We have a table in our system that would benefit from a numeric column
I have numeric data that I am getting from a database. They are all

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.