Splitter in Qt5 is invisible - c++

I have been creating a small frame window with a splitter object, using the Qt Designer. What is strange though is, that the splitter is working, so when I move the mouse where it should be, the cursor switches it's shape and I can drag the splitter, but the splitter bar itself is invisible.
Is this a bug from Qt5? I'm using Qt 5.2.1 OpenSource with MingW on Windows 7.
(source: picr.de)
Update
I created now a bugreport for this issue

I have also invisible splitter (Using Qt 5.3).
But I am using some complex style sheet which colors it in a way I need and it is visible that way:
QSplitter::handle {
background-color: #333;
}
Please check the docs how to apply style sheet.

Related

Qt pushbutton palette

I'm using GUI form editor in qt creator, I have set the background
(right_click -> change_stylesheet->Add Resource -> background_image)
Then I added a few buttons, the buttons are colored like the background, instead of being normal - default. I was trying this with properties->palette but with poor results. I'm new to qt, so I am asking for your help.
Like in CSS, Qt Style Sheet will apply your styling rules to any item that matches them.
If you just write:
background-image: url(:/my_background.png);
it will change the background of all the widgets in your application.
If you want to change the background of the main window only, you should write:
QMainWindow {
background-image: url(:/my_background.png);
}
That will apply the background image only to the QMainWindow object.
For an detailed explanation of Qt Style Sheet, I invite you to read the official documentation here.

QT window within window?

I'm setting up a small code editor using QT and following this example. However, i'm curious on how to create windows within windows or widgets within widgets. I'm trying to achieve something similar to these:
http://i.stack.imgur.com/Vn8Ut.png
http://www.hanselman.com/blog/content/binary/Windows-Live-Writer/Download-Visual-Studio-2013-while-your-f_1431E/image_4eb5427c-1ae7-4464-9c26-2282fe8d06c3.png
Is there an example of overlaying widgets like this?
Any alternative soloution for QMessagebox for IOS development (QWidget application only)?
I gave an example of getting another QWidget to be embedded and painted on top of another one. Let me know if you have any questions about how it was done.
The PopUp flag and Qt::Tool options are also relevant.
Be sure to check out: the ToolTip property of a QWidget and the WhatsThis property of QWidget.
http://qt-project.org/doc/qt-5/qwidget.html#toolTip-prop
http://qt-project.org/doc/qt-5/qwidget.html#whatsThis-prop
There are also other ways to make borderless, focusless windows that hover and disappear quickly on command. The Window Flags and Widget Attributes in Qt are very powerful when you are looking to modify Qt Widgets.
When you parent a Widget to another widget, it will draw itself on top of the other. Then you just need to resize and position it properly.
Also subclassing existing widgets can give you more options.
Draw text on scrollbar
Also common Qt::Tools that you will find are QDockWidgets. They are awesome!
Hope that helps.
Take a look at Qt Namespace especially Qt::WA_LayoutOnEntireRect and Qt::WA_StyleSheet. Pass it as a widget attrybutes. The second option looks promising but you have to create style sheet for QWidget.

How would you build a windowless application with C++/Qt5?

How would you build a windowless application with C++/Qt5? Do I have to use QDialog or QWidget?
For example, Launchy has no window border and the background around the text box is transparent.
I think that's what you're looking for :
http://qt-project.org/doc/qt-4.8/widgets-shapedclock.html
This is a tutorial on how to make a shaped and borderless window with Qt.
It's for Qt4.8 though, i think it should work on Qt5.
EDIT : Found the Qt5.0 version : http://qt-project.org/doc/qt-5.0/qtwidgets/widgets-shapedclock.html
Use a QWidget with Qt::SplashScreen or Qt::FramelessWindowHint. Check all the other window flags.

Customize QScrollBar intersection using stylesheet Qt

I’ve already customize my horizontal and vertical scrollbars using a stylesheet no problem.
But there still an annoying tiny area which remains blank :
The intersection of an horizontal and vertical bar. A small rectangle.
How could I change its color ? (Using stylesheets )
Thank you !
Qt 4.7.1 on Mac OSX Snow Leopard
Ps: Even on the Qt stylesheet example it’s still white.
I realise this is an old question, but I found a better solution.
QAbstractScrollArea::corner {
background: somecolor;
}
Or, to hide it, use:
background: transparent;
By default, the scroll area corner will be painted with the Window palette. Unfortunately, you cannot change the Window palette using only stylesheets. However, what you can do is create a dummy widget and set it to be displayed in the corner area with QAbstractScrollArea::setCornerWidget(QWidget *widget), and then use the stylesheet to change the color of that widget.

Qt Tray Icon Drag and Drop

Does anyone know if it is possible to use drag and drop with a tray icon using Qt?
I've been doing some research and here is what I have come up with:
A QSystemTrayIcon cannot explicitly handle a drag/drop event. However there is a workaround based on the Spifftastic tray icon location method.
You create a uniquely colored icon
and place it as the icon for a brief
moment and take a screenshot of it.
Given that you know the color
sequence for the icon, you can
search through the screenshot and
locate the particular icon's
location.
A transparent widget is positioned
over the icon and is used as the
drop target.
I have yet to work at a few of the finer details of the operation but that is the gist of it. All things considered it is a hacky way of things but given that there are no other ways to do this I think it is acceptable.
Fluffy App (written in C#) uses the Spifftastic method to locate the tray icon. I'm assuming the part about the transparent window is how they accomplish that but I have yet to decompile and examine their system.
Since QSystemTrayIcon is a QObject, not a QWidget, my guess is this is not possible. The system tray icon isn't really owned by Qt - it's passed on to the 'desktop', i.e whatever part of the Gnome/KDE/Windows/Mac is drawing the relevant area. At least on Mac, you'd be dropping on the menu-bar, which would be a very strange UI. For Gnome and KDE it's a FreeDesktop.org standard, but again I don't think its your process which actually does the drawing, and hence there's no way for Qt to get events such as drag and drop to you.