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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:04:42+00:00 2026-05-13T13:04:42+00:00

I have the following problem with QT model/view framework. I want to render a

  • 0

I have the following problem with QT model/view framework. I want to render a widget inside a table view item.

First my thought was to use

void QAbstractItemView::setIndexWidget( const QModelIndex & index, QWidget * widget )

But the documentation for this function explicitly states:

This function should only be used to
display static content within the
visible area corresponding to an item
of data. If you want to display custom
dynamic content or implement a custom
editor widget, subclass QItemDelegate
instead.

So they propose to use delegates here. Well, so far so good. I know that the delegates may be used to create an editor, which may be basically any QT widget. But here is the problem – I don’t want this widget to be an editor – I want to render the item with this widget always. And not just “render”, I need it to have the exact behavior of the widget.

Now the widget I want to use is a custom widget, which is a container of some other widgets (few check-boxes, few buttons with some layout).

The solution I consider is like this:

  1. Grab the look of my custom widget to a pixmap.
  2. Let the delegate paint itself using this pixmap.
  3. When the mouse is over an item cause the view to automatically start editing (I don’t
    know how to do it yet, but I suppose it’s possible)
  4. Let the delegate create my widget as the editor for an item.

This solution seems to work, but it smells bad for me. Can anyone thing about more elegant solution for this problem?

Thanks.

  • 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-13T13:04:43+00:00Added an answer on May 13, 2026 at 1:04 pm

    Delegates are in charge of creating editors as well as doing all necessary display. They may use styles to do much of the painting, like drawing a progress bar, or paint manually.

    A delegate, however, is not a widget. Unless an editor has been invoked, it doesn’t have access to most things a widget would. The two are very different, have different purposes, and accomplish different things.

    One of the most troublesome aspect of delegates is that they are static. Unless something in the model triggers an update (or the widget is configured to watch hover events), the delegate won’t be used to redraw whatever data is present — the buffered representation will be drawn to the screen.

    You have some control over when an editor is invoked with edit triggers, although you can definitely handle it with some custom code, such as through mouse tracking.

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

Sidebar

Related Questions

I have following problem. In my view model I defined some list properties as
I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and
I have following problem: have to model classes (posts and users). Main view is
I have a following problem. I have a class in the entity framework model
Ive got the following problem. I have a model called user which has a
I have an interesting problem with hibernate, the model looks like the following: @NamedQueries({
I am using GWT/JAVA for development. I have following problem: I want to remove
I have the following view <ul data-role=listview data-inset=true> <!-- ko with: model.Item_selected --> <li
I'm learning Griffon framework and I have the following problem: mvcGroupInit isn't invoked when
I have a strange problem with my model passed to the View Controller [Authorize]

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.