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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:31:46+00:00 2026-05-11T16:31:46+00:00

I have two processes which exange messages each other. Process A is a normal

  • 0

I have two processes which exange messages each other.
Process A is a normal (i.e non-qt) program which sends messages to process B.
Process B is a QT GUI application showing received messages into a text box.

I created a customized widget (called ShowMessages) which inherits from QPlainTextEdit and reads messages from a pipe when a timer expires, and appends them in the text box.
Code is not really designed like this (which would be pretty bad design I think), but it’s just to make things simple here.
For reasons I won’t tell, process A cannot be shut down while I’m creating the form using qt-designer.

Problem is that while I’m using qt designer (thus selecting the ShowMessages widget and putting it within the window) the widget begins to show messages, even if I’m in the designer. This feature is cool but the problem is that when I save the form, already present messages are saved in .ui file, which results in turn in bad behaviour when I start process B (because process starts showing messages I received during the creation phase).

I could clean the text box just after process B starts, but I think that avoiding messages to be present in the .ui file is much better. What I want is to be able to write code like this for the widget:

if <I'm not in the designer>
    timer = QtCore.QTimer(self)
    QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"), self, QtCore.SLOT("on_timer()"));
    timer.start(2000)

Is there an qt function to know if I’m in the designer? Do you think that distinguishing between designer and runtime code is “bad”?

(Sorry for mistakes, but English is not my primary language)

  • 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-11T16:31:46+00:00Added an answer on May 11, 2026 at 4:31 pm

    Maybe your widget should have a flag for whether it’s “active” and default it to False so while you’re in the designer, it doesn’t do anything at all. In code you would set it to active when you want to see the messages. Then you also have the ability to turn it off in other scenarios as well.

    But I have to say, it sounds like you’re putting “controller” code into a “view” widget which can and probably will spell trouble for you down the road (including the current Qt designer problem you’re having now).

    Consider reading up on the MVC (model-view-controller) design pattern, if you haven’t already.

    Update:

    To be fair, your question did ask how to detect whether you’re in designer 🙂

    http://doc.trolltech.com/4.3/designer-creating-custom-widgets.html#creating-well-behaved-widgets

    To give custom widgets special
    behavior in Qt Designer, provide an
    implementation of the initialize()
    function to configure the widget
    construction process for Qt Designer
    specific behavior. This function will
    be called for the first time before
    any calls to createWidget() and could
    perhaps set an internal flag that can
    be tested later when Qt Designer calls
    the plugin’s createWidget() function.

    According to the doc, you basically could set your “inDesignerFlag” to true in the initialize() function of your widget. Then detect that flag where required in your widget’s code.

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

Sidebar

Ask A Question

Stats

  • Questions 151k
  • Answers 151k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A buffer is a space in memory where data is… May 12, 2026 at 9:53 am
  • Editorial Team
    Editorial Team added an answer I have found one compromise. It's still a little awkward,… May 12, 2026 at 9:53 am
  • Editorial Team
    Editorial Team added an answer Going native API is the most performant choice by definition… May 12, 2026 at 9:53 am

Related Questions

I have two processes one will query other for data.There will be huge amount
The Windows API DuplicateHandle() http://msdn.microsoft.com/en-us/library/ms724251(VS.85).aspx Requires the Object handle to be duplicated and a
I have two C++ processes (A and B), executing under Windows, where one launches
I have a table in a SQL Server 2005 Database that is used a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.