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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:14:45+00:00 2026-06-03T09:14:45+00:00

I have a GUI written in C++ with the Qt library. For my application

  • 0

I have a GUI written in C++ with the Qt library. For my application I used a TreeView object. To make the reuse of this object easy I made a templated class which my QObjects can inherit from. Since moc cannot work with templated classes I made the class like this:

class Tree : public QObject, public TreeTemplate<TreeType, TreeItemType>
{
     Q_OBJECT
};

This allows only the Tree class to use moc (TreeTemplate does not inherit QObject or use the Q_OBJECT macro), while getting the benefits of template.

My issue is that upon exiting my application crashes, without fail (even if I call exit and skip the QApplication cleanup). I am thinking there might be an issue with the generated classes for moc, with their “static-meta-objects”

I cannot use valgrind, due to use of __ASM__ that it cannot process. 🙁

Does anyone know if my design of using templated Qt class (+moc) that inherits from a templated class would cause this issue?

Crash is in: libc.so after exit.

  • 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-03T09:14:47+00:00Added an answer on June 3, 2026 at 9:14 am

    AFAIK, your approach will not work.

    The moc is ran before the C++ preprocessor, that’s why QObject and templated classes don’t work – the preprocessor hasn’t generated the classes yet. You are templatizing the class so the moc‘s data about the class won’t match the signature of whatever template classes are created from it during the preprocessor.

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

Sidebar

Related Questions

I'm not entirely sure this is possible. I have a legacy GUI application written
I have written a simple GUI in Python using the Tkinter library. This GUI
I have complex GUI application written in Python and wxPython. I want it to
I'm a new bit in Qt... I have a Qt GUI application (written by
I have written an image processing application with the GUI part written in Java
We have a mature Windows desktop application written in C++. The application's GUI sits
I have a Server application with a GUI. Written in c#. Now I want
I have a command-line application written in C++ and built with gcc/make that runs
i have gui written on delphi, i made comvisible assembly from .net assembly, and
I have written a GUI application which after performing some analyses on a large

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.