How can I remove borders from a Windows QML application - windows

This is similar to question 4799748, but I'd like to remove Windows borders from a QML application, so it starts up without minimise/maximise/close etc.
I guess I need to set the Window flags to Qt.CustomizeWindowHint, but I'm new to QML and can't see how to do that. The editor auto-completes the Qt.CustomizeWindowHint text, but I can't see how to apply that to the top level window.

Marko Frelih,
It's easy, just put flags: Qt.FramelessWindowHint inside your ApplicationWindow QML code

You need to set the Qt::FramelessWindowHint window flag. Since QDeclarativeView doesn't have a constructor accepting window flags you will have to set them after creating the view:
QDeclarativeView *viewer = new QDeclarativeView(0);
viewer->setWindowFlags(Qt::FramelessWindowHint);
viewer->setSource(QUrl::fromLocalFile("main.qml"));
viewer->show();
BTW, if you are using qmlviewer, you can pass -frameless to remove the border from its window.

Use flags: Qt.WindowFullScreen it works .
Other options:
flags : Qt::WindowFlags

Related

WIN32: Duplicate Standard Button Control (disabled Icon / hotkey underline) in Owner Draw Button?

So for the simple feat of wanting to put an icon on the right side of button text instead of the left resulted in having to use owner draw buttons (but someone here said Custom Draw is actually available if using visual themes). Okay, fine, but now I'm finding you can't really duplicate what Windows standard buttons do when it's not in owner draw mode.
For a normal enabled button I can get the look correct by checking if visual styles are available or not and then using either the DrawThemeBackground() / DrawThemeText() or DrawFrameControl() / DrawText(). However the hot key underline character is shown even when alt key is not pressed, the default buttons don't show it until alt pressed.
For a disabled button, I can't duplicate the disabled look of the icon placed on the button. I tried DrawState() over DrawIconEx() but that looks like the old Windows 3.1 type grey graphic not the visual style dimmed graphic. I see there is a DrawThemeIcon() for an image list, I guess I could try that (I'd have to test non visual style mode to see if DrawState() matches when not using visual styles).
Also, as you hover over the button, the state doesn't change, I understand that if using owner draw, that doesn't occur, maybe it would still work with Custom Draw?
So the two main questions are:
1 - Is there something built-in to the button / owner draw to handle the underlined hotkey only when alt was pressed?
Update to Question 1: I found DT_HIDEPREFIX in DrawText() and using Custom Draw there is the CDIS_SHOWKEYBOARDCUES flag. However with Owner Draw I'm not sure if there is a flag someplace?
2 - How do you draw an icon for a button that is disabled to match what default buttons do?
TIA!!
For shortcut underline you can use WM_QUERYUISTATE to ask if it should be hidden or visible
DWORD draw_text_flags = ...;
if ( SendMessage( control_hwnd, WM_QUERYUISTATE, 0, 0 ) & UISF_HIDEACCEL ) != 0 )
{
// hide prefix
draw_text_flags |= DT_HIDEPREFIX;
}
// some combination of PBS_DEFAULTED, PBS_DISABLED, PBS_HOT, PBS_NORMAL, PBS_PRESSED;
int state = ...;
DrawThemeText( theme, hdc, BP_PUSHBUTTON, state, text, text_len, draw_text_flags, 0, rect );
Answer to Q2: If you create an HIMAGELIST using ILC_COLOR32 | ILC_MASK, and use ILD_NORMAL|ILD_BLEND25 on ImageList_Draw() it gives the same look as windows default buttons for a disabled button.
Based on responses from #Remy-Lebeau and #Daniel-Sęk and reviewing various projects on CodeProject, I create an easy to use class to handle this. It can be found at CodeProject. Thanks Guys.

Windows IupLUA, iupalarm - how to make it the topmost window?

I want to set the "topmost" attribute for iup.Alarm and iup.message dialogs.
According to people on one of the iup forums, iup.Alarm and iup.Message cannot be set to the topmost window.

Pyside Remove window flags

Im designing a Pyside Qt application and I want to toggle the QtCore.Qt.WindowStaysOnTopHint window flag in my main window. Setting this hint using this code works fine:
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.show()
but I can't work out how to remove a window flag using Pyside.
Does anybody know how to do this?
Window flags would normally be OR'd together with the existing flags:
print(int(self.windowFlags()))
self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
print(int(self.windowFlags()))
Then to remove the flag, AND it out using the flag's negation:
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
print(int(self.windowFlags()))
You can toggle the window's showing at the top or bottom like this:
def toggleFunc(self):
if self.someCheckedButton.isChecked(): #show up at the top
self.setWindowFlags(self.theMainWindow.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
else: #show up at the bottom
self.setWindowFlags(self.theMainWindow.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
self.show() #it's important to show up the window again after changing the window flags

How can I produce an OSD in Windows?

I want to create an on-screen display, i.e. text or simple graphics that appear on top of everything else being displayed. I know in Linux this is achieved with xosd, but how do you do it in Windows? (Assume XP and up if it makes it easier, and I would also be interested in knowing if the method is different in Vista/7)
You can use NativeWindow to do this as described here.
The article explains how to create an
OSD window with
animation/semi-transparent effects, in
C#, using the NativeWindow class.
Use the WS_EX_LAYERED style to make the window transparent, and SetWindowPos(..., HWND_TOPMOST, ...) to make it float above other windows.
You can call SetForeGroundWindow

How to create full screen window with MFC?

I want to create full screen topmost (screen saver) window with MFC? How to create such full screen window in MFC? I tried to create win32 application and i am able to create fullscreen top most window but i want to create using MFC so later i can put different MFC controls on that window?
Please help me.
Thanks,
Jim.
I think removing the border from the dialog resource and showing the window as maximized (ShowWindow(SW_SHOWMAXIMIZED)) should do the job.
As for topmost use the System Modal style in the dialog resource.
I do it with a Dialog Box app. In the resource editor properties for the dialog resource, set Border=None and Title Bar=False to eliminate all border elements. In OnInitDialog, use the following to resize the dialog to the entire desktop:
CRect rcDesktop;
rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
rcDesktop.right = rcDesktop.left + GetSystemMetrics(SM_CXVIRTUALSCREEN);
rcDesktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
rcDesktop.bottom = rcDesktop.top + GetSystemMetrics(SM_CYVIRTUALSCREEN);
MoveWindow(rcDesktop, FALSE);
This code works on multiple monitors, unlike maximizing the window.
No need to worry about making the window topmost, Windows will display it on a dedicated desktop with no other windows present.
You should be able to adapt the example code here to do what you want:
MSDN: Initializing a dialog box

Resources