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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:00:33+00:00 2026-06-01T03:00:33+00:00

I have an inactive QMainWindow with a QTabWidget as CentralWidget which holds multiple QPlainTextEdits

  • 0

I have an inactive QMainWindow with a QTabWidget as CentralWidget which holds multiple QPlainTextEdits. Beside that I have a seperate QWidget flagged with Qt::WindowStaysOnTopHint and Qt::Tool which I want to use as a find/replace tool for the QPlainTextEdits.

Now when I use the tool widget the QMainWindow is shown as inactive like it should and the selection background of the selected text in the active QPlainTextEdit is rendered as inactive (slightly grey) but I want the selection to be rendered like the QMainWindow would be active, with the default selection color w/o loosing the focus on the tool widget.

How do I achieve that?

  • 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-01T03:00:34+00:00Added an answer on June 1, 2026 at 3:00 am

    Try something this:

    QPalette p = myInactiveWidget->palette();
    for (int colorRole=0; colorRole<QPalette::NColorRoles; colorRole++) p.setColor(QPalette::Inactive, colorRole, p.color(QPalette::Active, colorRole));
    myInactiveWidget->setPalette(p);
    

    That should make (myInactiveWidget)’s inactive-color-palette the same as its active-color-palette, so that it no longer looks inactive. Or if all you care about is the color of the text-selection-block, then this would probably be sufficient:

    QPalette p = myInactiveWidget->palette();
    p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight));
    p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText));
    myInactiveWidget->setPalette(p);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITabBarController that holds several tabs of which one tab (third Tab,
I have a control that goes inactive under some conditions in my iPhone app.
I have a transparent PNG that partially overlaps a button. The buttons becomes inactive
I want to have a group of radiobuttons that are inactive until a checkbox
Hi I'm trying to have my uitableviewcell rendered inactive so that a user can't
In my app I want to have certain buttons that are inactive when there
I have a table which has active an inactive entries, active = 1 for
I have a table with active/inactive users, as well as a drop-down that will,
I have 3 divs with 2 possible image tags for each (active or inactive).
I have 2 tables, an active table and an inactive table. I want to

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.