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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:12:59+00:00 2026-05-27T00:12:59+00:00

I have a .h file with such code: const QEvent::Type MyOnEventType = QEvent::Type(QEvent::registerEventType( QEvent::User

  • 0

I have a .h file with such code:

const QEvent::Type MyOnEventType =
           QEvent::Type(QEvent::registerEventType( QEvent::User + 500 ) );

This header uses twice in application. I found a problem that in different places MyOnEventType have different integer value. If make a break point on that code above, debugger stops 9 times.

Please help how to declare custom QEvent type ONCE

  • 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-27T00:13:00+00:00Added an answer on May 27, 2026 at 12:13 am

    I’m not 100% sure I’m understanding your question, but it sounds like you need to separate the declaration and the implementation. Something like:

    my_event.h

    class MyEvent : public QEvent {
     public:
      static const QEvent::Type MyEventType;
      // etc. 
    };
    

    my_event.cpp

    #include "my_event.h"
    
    const QEvent::Type MyEvent::MyEventType = 
            static_cast<QEvent::Type>(QEvent::registerEventType());
    
    // etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why does Java not have a file copy method? This seems like such an
I have such code to read a text file using BufferedReader : BufferedReader reader=null;
I have a file with entries such as: 26 1 33 2 . .
I have my CSV file imported as such: records = FasterCSV.read(path, :headers => true,
Assuming that I have a typedef declared in my .h file as such: typedef
I have a large file where each line contains a substring such as ABC123.
I have two HANDLEs and they are created from the same file, in such
I have wrote a user manager script the uses NTLMSetUserInfo to set passwords of
i have a file that looks like this: TTITLE0=track name 1 TTITLE1=track name 2
I have a text file with hundreds of entries formatted like this, I need

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.