I am trying to create a fade out effect, instead of elide in the QTabBar.
I need to detect if eliding is required and then fade out the text instead of ....
I have tried adding a QSS class but it didn't produce the desired outputs.
Documentation and existing code isn't helping either, any help is appreciated.
Related
I want to compare two TextArea's text ,and change the different text's line background color,but i don't know how can have tow background color in one TextArea. Maybe should custom to get it,what should i do?
or import .js to get it ? what should i do?
As a more advance solution, you can manipulate TextArea content with https://doc.qt.io/qt-5/qtextdocument.html QTextDocument. Original text document is available via this property https://doc.qt.io/qt-5/qml-qtquick-textedit.html#textDocument-prop . From this point, you can assign your own syntax highlighting. But it requires research from your side.
From the other side, you can check this example https://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html and using this class https://doc.qt.io/qt-5/qsyntaxhighlighter.html you can assign the existing QTextDocument to QSyntaxHighlighter. The same, I guess, can be used for QML TextArea element.
Since TextArea has textDocument property it should be possible re-implement it for QtQuick Constrols.
To be honest I've never dealt with such a task, but this example looks pretty useful for such cases. Probably you should stick with rich text format option suggested in comments if you don't need advanced features (like real-time content changes).
I'd like to create a context menu looking similar to this one:
I read suggestions on the web that QWidget::setMask() should be used to create a shape. But how can it fit the variable number of items then? Moreover, the same menu item may take more or less screen space on different machines.
Another question is how to create a shadow around this custom shape? As far as I understand, the mask allows to crop the widget, but not to make it semi-transparent.
I don’t found an easy way to do that! But here goes a way!
Instead of using the Qt mask API, I've used a frame-less widget with transparency enabled!
To draw the shadow, I've used radial gradient!
You can change the size of the menu before opening it, however you can’t resize it after opened (for example resize with mouse).
It’s quite easy add or remove widgets, just respect the layout margin to not draw outside the bounds destined to widgets. To simplify your life I created an inherited class of QPushButton with colors you can easily customize with style sheet.
See the result:
You can browse the source
Hope that helps!
I can't really even describe what the effect's name, but its the effect appear usually on the top right of the typing input bar when the other side is typing. For example in hangout, there is one like this
I wonder how can I achieve such effect in css, in other words, those green fading effected loading effect on those 3 dots with CSS only?
Thanks
Some links and demos (javascript + css3)
fancyInput
TextInput fx
10 js text fx
textilate
typed.js
create typing effect
I want to round specific corners of buttons to create something like mx.controls.ButtonBar. But I cannot figure out how ButtonBar does this even after looking at its source. I thought the focusRoundedCorners css property was the answer but that applies only to drawing the button's focus box. Any idea on this would be greatly appreciated!
You can do this by creating custom skins for your buttons. Take a look at the source file in the Flex SDK for ButtonBarFirstButtonSkin.mxml (assuming you are using SDK 4). In a nutshell, when you draw the background/border/fill, you set topLeftRadiusX (or whatever corners you want rounded) on the Rect object. After creating your skin, assign it to the button in your CSS. Hope that helps.
I'm displaying an animated gif in my application by creating a QLabel, and setting the movie as a QMovie. The problem I'm having is that when the gif is displayed, any part of the image that stays a constant color throughout the animation shows up as the background color. I hope I'm explaining that clearly. Here's the code I'm using to create the animation if that helps:
rewardLabel=new QLabel();
rewardLabel->setCursor(QCursor(Qt::BlankCursor));
rewardLabel->setWindowFlags(Qt::FramelessWindowHint);
rewardLabel->hide();
string movieTemp="animations/"+animationFiles[animationIndex];
QString movieFile(movieTemp.c_str());
rewardMovie=new QMovie(movieFile);
rewardLabel->setMovie(rewardMovie);
Let me know if I need to explain the situation better. Thanks in advance.
Take a look at the QWidgets window attributes. I believe the ones you're interested in are:
Qt::WA_OpaquePaintEvent
Qt::WA_NoSystemBackground
Qt::WA_TranslucentBackground
There might be a couple of widget flags of interest too, but I think they've all been moved to flags in Qt-4.