For my Qt Dialog Window, I am trying to create a checkbox that is centered, but is always checked and uncheckable.
I did this by combining
ui->baseBox->setStyleSheet("margin-left:50%; margin-right:50%;");
and
ui->baseBox->setAttribute(Qt::WA_TransparentForMouseEvents);
ui->baseBox->setFocusPolicy(Qt::NoFocus);
However, I can only do the first bit of code or the second. When I run the both of them together, my checkBox baseBox completely disappears from the GUI.
So I tried doing :
ui->baseBox->setAttribute(Qt::WA_TransparentForMouseEvents);
ui->baseBox->setFocusPolicy(Qt::NoFocus);
ui->baseBox->setStyleSheet(ui->baseBox->styleSheet().append(QString("margin-left:50%; margin-right:50%;")));
based on How to add style via setStyleSheet() without losing orignal style in Qt?
However, I am running into the same problem.
How can I do both of these things ? Why is my check box disappearing ?
Well I am working with visual studio 2015 on an mfc project.
I have enabled the office like ribbon in the project creation wizard.
I am inheriting from CView for my view class to get printing support as documentation suggests.
I have also overrided OnDraw too.
Now I want to get a print preview of the document with the print preview options on the ribbon.
I don't know where to start or how to act.
Any suggestions, propositions or examples ?
Thanks in advance.
You do not need to do it again for print preview window.
When you start a new "MFC application" for MDI and "Ribbon control", the application it self provides a print preview option.
Once you create a new application, Run the application.
The application runs and a windows opens.
Select the options as shown in below images.
You will get "print preview" option.
Search in the source code for "print view" to understand how it is implemented.
I am new to qt and I have an issue I cannot understand.
I have created my own QDialog and now I want to add it to an existing application.
In QT creator, everything works fine but when I add either my custom dialogue or even a
message box to the existing code, something odd happens.
The dialogue works just fine but when I hover over the main area of the dialogue
the icon changes to a Qt::BusyCursor the busy wait icon.
At first I assumed this must be a threading issue but then isn't .exec() suppose to block?
Also when I hover over the title bar or the message box / dialogue, it seems fine i.e it shows a Qt::ArrowCursor, in both cases the dialogue functionally works fine also.
I have tried to set the .setCursor() on both and it did not work still a busy icon.
can anyone give me some hints as to what I might look at to investigate this more.
Thanks a lot!!!
I can suggest you to use
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
and reset it with
QApplication::restoreOverrideCursor();.
Probabbly i am not sure what to search for ... But the idea is to display a message bar bellow ribbon control. When user try to edit a read only file. I don't want user to click on OK to remove error message. Thats why i can't use MessageBox.
Status bar doesn't seem right place to display error messages.
Which control i should start exploring.
MSOffice normally displays such message when user opens files in protected view .
I don't want you to do research for me, I just want the right direction i will do the rest.
Thanks
You can easily use CMFCCaptionBar for such an attempt. When you create a ribbon bar SDI application you get sample code for free.
Also it is possible to hide and Show such a bar on the fly with ShowWindow. Also this code is generated by the wizard.
i have a application i have been making a for a while now using C++/Win32 and when i create my first dialog it shows up weird when i dont have aero enabled or i am not using windows 7/8.
here is a screenshot of what it looks like:
This is my last resort, as i have no idea why this is doing it. It only happens to the first dialog i make, after the user logs in the rest of the dialogs are fine. It works just fine with aero.
here is my dialog resource script
IDI_MAINDLG DIALOGEX 0,0,195,54
CAPTION "Absolute Hacks Loader"
FONT 8,"MS Shell Dlg",400,0,1
STYLE WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|DS_CENTER|DS_MODALFRAME|DS_SHELLFONT
EXSTYLE WS_EX_TRANSPARENT|WS_EX_TOPMOST|WS_EX_DLGMODALFRAME
BEGIN
CONTROL "Login",IDI_LOGIN_BTN,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|BS_DEFPUSHBUTTON,156,12,33,15
CONTROL "",IDI_USER_TEXT,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|ES_CENTER,45,6,104,13,WS_EX_CLIENTEDGE
CONTROL "Username:",IDC_STATIC,"Static",WS_CHILDWINDOW|WS_VISIBLE|WS_GROUP,3,6,39,12
CONTROL "Password:",IDC_STATIC,"Static",WS_CHILDWINDOW|WS_VISIBLE|WS_GROUP,3,24,33,9
CONTROL "",IDI_PASS_TEXT,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_PASSWORD|ES_CENTER,45,24,104,12,WS_EX_CLIENTEDGE
CONTROL "Remember me",IDI_REMEMBER,"Button",WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,135,42,57,9
CONTROL "Coded By DaRk_NeSs",IDC_STATIC,"Static",WS_CHILDWINDOW|WS_VISIBLE,3,42,75,9
END
Remove the WS_EX_TRANSPARENT style from EXSTYLE.
I wrote a little program with a dialog box and the dialog box looked very strange with WS_EX_TRANSPARENT and normal without it.