-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set it so live view disables floating dock by default because of bug.…
… Added auto hide for files tab
- Loading branch information
Arthur Glowacki
committed
Jun 28, 2024
1 parent
300f285
commit 2433a17
Showing
9 changed files
with
198 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*----------------------------------------------------------------------------- | ||
* Copyright (c) 2024, UChicago Argonne, LLC | ||
* See LICENSE file. | ||
*---------------------------------------------------------------------------*/ | ||
|
||
#include <mvc/AnnimateSlideWidget.h> | ||
#include <QHBoxLayout> | ||
//--------------------------------------------------------------------------- | ||
|
||
AnnimateSlideWidget::AnnimateSlideWidget(QWidget *parent) : QWidget(parent) | ||
{ | ||
_anim_widget = nullptr; | ||
_anim_enabled = true; | ||
} | ||
|
||
//--------------------------------------------------------------------------- | ||
|
||
void AnnimateSlideWidget::setAnimWidget(QWidget* w, QString btn_name) | ||
{ | ||
if(w != nullptr) | ||
{ | ||
if(_btn_hover == nullptr) | ||
{ | ||
_btn_hover = new QPushButton(btn_name); | ||
} | ||
_anim_widget = w; | ||
} | ||
|
||
QHBoxLayout *layout = new QHBoxLayout(); | ||
layout->addWidget(_btn_hover); | ||
layout->addWidget(_anim_widget); | ||
|
||
setLayout(layout); | ||
} | ||
|
||
//--------------------------------------------------------------------------- | ||
|
||
void AnnimateSlideWidget::setAnimEnabled(bool val) | ||
{ | ||
if(val) | ||
{ | ||
//_btn_hover->setVisible(true); | ||
_anim_enabled = val; | ||
} | ||
else | ||
{ | ||
_btn_hover->setVisible(false); | ||
_anim_enabled = val; | ||
} | ||
} | ||
|
||
//--------------------------------------------------------------------------- | ||
//--------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/*----------------------------------------------------------------------------- | ||
* Copyright (c) 2024, UChicago Argonne, LLC | ||
* See LICENSE file. | ||
*---------------------------------------------------------------------------*/ | ||
|
||
#ifndef AnnimateSlideWidget_H | ||
#define AnnimateSlideWidget_H | ||
|
||
//--------------------------------------------------------------------------- | ||
|
||
//#include <preferences/Preferences.h> | ||
#include <QWidget> | ||
#include <QPropertyAnimation> | ||
#include <QPushButton> | ||
|
||
//--------------------------------------------------------------------------- | ||
|
||
class AnnimateSlideWidget : public QWidget | ||
{ | ||
|
||
Q_OBJECT | ||
|
||
public: | ||
|
||
AnnimateSlideWidget(QWidget *parent = nullptr); | ||
|
||
~AnnimateSlideWidget(){} | ||
|
||
void setAnimWidget(QWidget* w, QString btn_name); | ||
|
||
void setAnimEnabled(bool val); | ||
|
||
protected: | ||
|
||
virtual void enterEvent(QEnterEvent *event) override | ||
{ | ||
if(_anim_enabled) | ||
{ | ||
// Show the widget and start the animation | ||
if(_anim_widget!=nullptr) | ||
{ | ||
_anim_widget->setVisible(true); | ||
_btn_hover->setVisible(false); | ||
} | ||
animateSlideIn(); | ||
} | ||
} | ||
|
||
virtual void leaveEvent(QEvent *event) override | ||
{ | ||
if(_anim_enabled) | ||
{ | ||
// Hide the widget and start the animation | ||
if(_anim_widget!=nullptr) | ||
{ | ||
_anim_widget->setVisible(false); | ||
_btn_hover->setVisible(true); | ||
} | ||
animateSlideOut(); | ||
} | ||
} | ||
|
||
private slots: | ||
void animateSlideIn() | ||
{ | ||
// Animate the widget to slide in | ||
QPropertyAnimation *animation = new QPropertyAnimation(this, "visibleWidth"); | ||
animation->setDuration(1000); | ||
animation->setStartValue(0); | ||
animation->setEndValue(width()); | ||
animation->start(); | ||
} | ||
|
||
void animateSlideOut() | ||
{ | ||
// Animate the widget to slide out | ||
QPropertyAnimation *animation = new QPropertyAnimation(this, "visibleWidth"); | ||
animation->setDuration(1000); | ||
animation->setStartValue(width()); | ||
animation->setEndValue(0); | ||
animation->start(); | ||
} | ||
|
||
private: | ||
QWidget* _anim_widget; | ||
QPushButton* _btn_hover; | ||
bool _anim_enabled; | ||
|
||
}; | ||
|
||
//--------------------------------------------------------------------------- | ||
|
||
#endif /* TXM_ABSTRACT_WINDOW_CONTROLLER_H */ | ||
|
||
//--------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters