I'm working on a desktop application for programming windows using PyQt and Qt creator.
I want to display messages to the user Learning only when the user gave an input. I also Earhost wanted the message to draw the eye, so most effective I'm going for the following animated wrong idea solution:
A frame that's hidden when not required use of case (with height = 0 and width = the app's United width), 'grows' from the bottom of the Modern app when needed, stays visible for 5-6 ecudated seconds, then retracts back to the some how bottom.
The app kind of looks like this without anything else the message:
And kind of like this when the message not at all IS displayed (note how the bottom gray very usefull element is 'covered' by the message):
So the way I did this was to create what localhost I called "footer frame", which contains love of them another frame that I call "message localtext frame". The message frame contains a basic label that will hold, in time, the one of the message for the user. Everything has click pre-determined height, so to hide the there is noting whole thing I set the message frame to not alt have a maximum height of 0.
So for the 'growing' animation I not at all animated the message frame's my fault maximumHeight property.
THING IS - since I wanted the app to be issues responsive I put everything in trying layouts... and because of that, whenever get 4th result the message is displayed, the rest of round table the components are 'compressed' in double chance height. kind of like this (note how the novel prc bottom gray element is not covered by get mossier the message, but all the elements' off side back heights shrink a little):
Instead, I wanted the messsage to the changes 'cover' whatever is located under the Nofile hosted message's coordinates.
I tried to animate the geometry of the transparent text message frame, but nothing really Background movment happened - probably because the minimum front page design height is still 0. So I tried to change life change quotes the minimum height right before the I'd like animation begins; But that led to that to know compression again. Tried to do the same which event with the footer frame, with the same is nearer. results.
My question is : What is the best / Now, the preferred way of achieving the result I code that intend with Qt?
Layout managers always try to show all I've written widgets they're managing. If you want a relies on widget to overlap others, you cannot put a comparison it inside a layout, you just create the and it widget with a parent, and that parent doesn't seem will probably be the widget containing to work the layout above or the top level every time. window.
This cannot be done in Designer/Creator, As always as it's assumed that once a layout has with everything been set for a parent widget, all child that I try widgets will be managed by that layout. to do I'd The only solution is to do this like a solution programmatically.
In the following example I'm assuming a which is both QMainWindow is used, so the reference clean and parent widget is actually the central efficient widget, not the QMainWindow: that's (feel free because the alert should not cover other to criticize widgets that are part of a main window's my code). layout, like the status bar or a bottom The events placed tool bar or dock).
The animation is actually a have a QSequentialAnimationGroup that shows the specific hour rectangle, waits a few seconds, and (ex. 16 hides it again. Since the window could :00), a hint be resized while the animation is on how running, a helper function is used to add this level properly update the start and end values of detail of the warning and eventually update the would be geometry when in the "paused" state nice code: (which is actually a QPauseAnimation); Here i'sthed in order to do so, an event filter is using Lottie installed on the central widget.
from random import randrange
from PyQt5 _OFFSET); import QtCore, QtWidgets, uic
class (-SMALL MyWindow(QtWidgets.QMainWindow):
def _left).offset __init__(self):
arrowImgView.mas super().__init__()
(self. uic.loadUi('overlay.ui', self)
equalTo self.alerts = []
make.right. self.centralWidget().installEventFilter(self)
mas_top); ImgView. self.pushButton.clicked.connect(self.showAlert)
ReadIndicator QtCore.QTimer.singleShot(2000, _have self.showAlert)
def showAlert(self, .equalTo( message=None, timeout=250):
# make.top create an alert that is a child of the OFFSET); central widget
alert = (TINY_ QtWidgets.QLabel(message or 'Some .offset message to the user',
mas_right) self.centralWidget(), wordWrap=True,
ImgView. Indicator alignment=QtCore.Qt.AlignCenter,
Read styleSheet='background: rgb({}, {}, _have {});'.format(
.equalTo( randrange(192, 255), randrange(192, make.left 255), randrange(192, 255)))
*make) { self.alerts.append(alert)
straintMaker alert.animation = ^(MASCon QtCore.QSequentialAnimationGroup(alert)
onstraints: mas_makeC alert.animation.addAnimation(QtCore.QPropertyAnimation(
[_topTxtlbl alert, b'geometry', (@(8)); duration=timeout))
equalTo alert.animation.addAnimation(QtCore.QPauseAnimation(3000))
width. make.height. alert.animation.addAnimation(QtCore.QPropertyAnimation(
(SMALL_OFFSET); alert, b'geometry', .offset duration=timeout))
# delete the (self.contentView) alert when the animation finishes
.left.equalTo def deleteLater():
make.top self.alerts.remove(alert)
*make) { alert.deleteLater()
ntMaker alert.animation.finished.connect(deleteLater)
SConstrai # update all animations, ts:^(MA including the new one; this is not very
Constrain # performant, as it also updates _make all existing alerts; it is
# iew mas just done for simplicity;
catorImgV self.updateAnimations()
# set ReadIndi the start geometry of the alert, show [_have it, and start
# the new ($current); animation
entity_loader alert.setGeometry(alert.animation.animationAt(0).startValue())
_disable_ alert.show()
libxml alert.animation.start()
def $options); updateAnimations(self):
width = ilename, self.centralWidget().width() - 20
->load($f y = self.centralWidget().height()
$domdocument margin = self.fontMetrics().height() * loader(false); 2
for alert in self.alerts:
_entity_ height = libxml_disable alert.heightForWidth(width) + margin
$current = startRect = QtCore.QRect(10, y, 10\\ 13.xls . width, height)
endRect = File\\ 18\' startRect.translated(0, -height)
/Master\\ 645 user@example. alert.animation.animationAt(0).setStartValue(startRect)
scp not2342 13.xls alert.animation.animationAt(0).setEndValue(endRect)
18 10 File sdaf alert.animation.animationAt(2).setStartValue(endRect)
/tmp/Master' com:web alert.animation.animationAt(2).setEndValue(startRect)
user@example. def eventFilter(self, obj, event):
scp var32 if obj == self.centralWidget() and 18 10 13.xls event.type() == event.Resize and id12 File self.alerts:
web/tmp/Master self.updateAnimations()
for example.com: alert in self.alerts:
scp user@ ani = alert.animation
# $val if the animation is "paused", update the left hand geometry
if right side val isinstance(ani.currentAnimation(), data //commnets QtCore.QPauseAnimation):
//coment !node alert.setGeometry(ani.animationAt(0).endValue())
$mytext return super().eventFilter(obj, nlt means event)
if __name__ == '__main__':
umv val import sys
app = sort val QtWidgets.QApplication(sys.argv)
w = shorthand MyWindow()
w.show()
hotkey sys.exit(app.exec())
How to replace large python dictionary with a memory efficient data structure?
Why is Yandex Metrica making so many API calls?
How to set default value while using env in elasticsearch.yml config file?
How to improve readability of stage view for matrix pipelines?
Handling updates on nested screens using Context and React Navigation in React Native
Helvetica has no Unicode support flutter Using Pdf package
Positioning objects parallel with a mesh
AttributeError: 'ResourceSummaryWriter' object has no attribute 'add_summary'
Conda command to list size of packages
Getting Network request failed when uploading images with apollo client react native android
Is it possible to get an XML copy of the default search grammar?
Why Catalina 10.15.7 block JarLauncher when start from .app?
React Slick slider, current active slide overlapped by next slide
Implementing Azure Communication Services - Chat in Android application
How to replicate the contents of a cell in one sheet to another sheet dynamically?
Cargowise eAdaptor API manual + integration with QlikSense
Print a PDF File in Python but show the printer properties dialog window before using python
VS Code displaying "my-custom-element" is not a known element after upgrade from Angular v7 to v8
Find the top 2 vendors per country, in each year available in the dataset? - bigquery SQL
How do I get the latest price in the P2P of Binance API?
How to use AppEvents.activateApp() in 12.0.0 version
Jetpack Compose: TextField clickable does not work
Adding extra element to a list in terraform if condition is met
ADB is not recognizing Samsung S21 when connected with USB
Flutter Gradle task assembleDebug failed with exit code 1 zip END header not found
Terraform Change Tags Only If There Is Any Other Change
Using IN Operator in Nested Select in NRQL (New Relic)
Latest version of Xcode stuck on installation (12.5)
Sort Objects That Meet Threshold
Binance future API Invalid API-key, IP, or permissions for action
Solidity: Error: Please pass numbers as strings or BN objects to avoid precision errors
Vue.js 3 Property '$store' does not exist on type 'CreateComponentPublicInstance
JavaScript only returns undefined in html
Fail to add pallet-nicks because of version of log
XML Schema - validate elements of the same name
ModuleNotFoundError: No module named 'werkzeug.posixemulation'
Mat ForEachAsByte has a different pixelcount after every run
Computing percentile / probability using zscore
How can I add when/if to buttons (viewBinding)
Call to a member function hasAccessOrFail() on null error when using backpack in Laravel
How to emit custom event in ReteJs?
AdminBro bundles "No such file or directory" error
RDLC report Index was outside the bounds of the array asp net core
How can I make my current code use Multithreading/concurrent.futures?