Example #1
0
int CropWidget::show() {

	QWidget::show();
	emit blockFunc(true);

}
Example #2
0
int CropWidget::hide() {

	QWidget::hide();
	emit blockFunc(false);

}
Example #3
0
// The animation function
void MyWidget::animate() {

	bool noAni = false;
	if(QFile(QDir::homePath() + "/.photoqt/mywidget_noani").exists())
		noAni = true;

	QRect shown;
	if(fullscreen)
		shown = rectShown;
	else if(borderLeftRight == -1 || borderTopDown == -1)
		shown = QRect((rectShown.width()-visibleArea.width())/2.0,(rectShown.height()-visibleArea.height())/2.0,visibleArea.width(),visibleArea.height());
	else
		shown = QRect(borderLeftRight, borderTopDown, rectShown.width()-borderLeftRight*2, rectShown.height()-borderTopDown*2);

	// Open widget
	if(!isShown) {

		if(fade->state() == QTimeLine::Running) {
			fade->stop();
			fadeStep(true);
		}

		// The background is initially transparent but the geometry is full
		this->setStyleSheet(QString("background: rgba(0,0,0,0);"));
		this->setGeometry(rectShown);

		// Widget is shown
		isShown = true;

		if(noAni) {

			fadeIN = true;
			center->setGeometry(shown);
			fadeStep(true);
			aniFinished();

		} else {

			// Prepare widget
			fadeEffectCenter->setOpacity(0);
			center->setGeometry(shown);

			// Start fade
			fade->setDuration(100);
			fade->setLoopCount(5);
			fadeIN = true;
			fade->start();

		}

		// Block all base functions
		emit blockFunc(true);

		// Make sure this widget is on top
		this->raise();

	// Close widget
	} else if(isShown) {

		if(fade->state() == QTimeLine::Running) {
			fade->stop();
			fadeStep(true);
		}

		// Widget is hidden again
		isShown = false;

		if(noAni) {

			fadeIN = false;
			fadeStep(true);
			aniFinished();

		} else {

			fade->setDuration(100);
			fade->setLoopCount(5);
			fadeIN = false;
			fade->start();

		}

		// Unblock all base functions
		emit blockFunc(false);

	}

}