bug fix 136675、128359

This commit is contained in:
daiboqi 2022-09-01 17:18:14 +08:00
parent a1f47123d6
commit 478dce7b2c
25 changed files with 454 additions and 172 deletions

View File

@ -75,6 +75,12 @@ About::~About()
{
delete ui;
}
void About::showThisWindow()
{
kdk::UkuiStyleHelper::self()->removeHeader(this);
this->show();
}
#define SYSTEM_FONT_EKY "system-font-size"
/*
*

View File

@ -46,6 +46,7 @@ class About : public QDialog
public:
explicit About(QWidget *parent = nullptr);
~About();
void showThisWindow();
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;

View File

@ -20,6 +20,7 @@
#include <QDebug>
#include <QThread>
#include <QStyleOption>
#include <QFontMetrics>
#include "theme.h"
BaseVerticalScroll::BaseVerticalScroll(int currentValue, int minRange, int maxRange, QWidget *parent) : QWidget(parent),
m_currentValue(currentValue),
@ -83,7 +84,7 @@ void BaseVerticalScroll::paintNum(QPainter &painter, int num, int deviation)
{
int Width = width() - 1;
int Height = height() - 1;
int size = (Height - qAbs(deviation)) / (m_numSize*1.5); //偏移量越大,数字越小
int size = (Height - qAbs(deviation)) / (m_numSize*1.7); //偏移量越大,数字越小
//The larger the offset, the smaller the number
int transparency = Utils::handelColorRange(255 - 255 * qAbs(deviation) / Height);
int height = Height / devide;
@ -109,20 +110,28 @@ void BaseVerticalScroll::paintNum(QPainter &painter, int num, int deviation)
Utils::handelColorRange(255-(qAbs(deviation)*2)),
Utils::handelColorRange(255-(qAbs(deviation)*2)),transparency));
}
QLinearGradient linearGradient(QPointF(5, 10), QPointF(7, 15));
linearGradient.setColorAt(0.2, Qt::white);
linearGradient.setColorAt(0.6, Qt::green);
painter.setRenderHint(QPainter::Antialiasing);
QLinearGradient linearGradient(QPointF(110, -30), QPointF(110, 114));
linearGradient.setColorAt(0.5, Qt::white);
linearGradient.setColorAt(0.8, Qt::gray);
linearGradient.setColorAt(1.0, Qt::black);
//指定区域外的扩散方式
linearGradient.setSpread(QGradient::ReflectSpread);
if ( y >= 0 && y + height < Height) {
// painter.drawText(QRectF(0, y, Width, height),
// Qt::AlignCenter,
// change_NUM_to_str(num));
QFont font = painter.font();
QFontMetrics fm(font);
QString str = change_NUM_to_str(num);
QRect rect = fm.boundingRect(0, y, Width, height,Qt::AlignCenter,str);
QPainterPath path;
path.addText(rect.x(),rect.y()+ fm.ascent() ,font,str);
painter.fillPath(path, linearGradient);
}
painter.setBrush(QBrush(linearGradient));
if ( y >= 0 && y + height < Height) {
painter.drawText(QRectF(0, y, Width, height),
Qt::AlignCenter,
change_NUM_to_str(num));
}
}
QString BaseVerticalScroll::change_NUM_to_str(int alarmHour)
{
QString str;
@ -201,3 +210,9 @@ void BaseVerticalScroll::mouseMoveEvent(QMouseEvent *e)
repaint();
}
}
void BaseVerticalScroll::mouseDoubleClickEvent(QMouseEvent *event)
{
emit srcollDoubleClicked();
QWidget::mouseDoubleClickEvent(event);
}

View File

@ -23,6 +23,7 @@
#include "primarymanager.h"
#include <QPropertyAnimation>
#include <QPainter>
#include <QLineEdit>
class BaseVerticalScroll : public QWidget
{
Q_OBJECT
@ -55,9 +56,11 @@ public:
signals:
void currentValueChanged(int value);
void deviationChange(int deviation);
void srcollDoubleClicked();
protected:
void wheelEvent(QWheelEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
private:

272
clock.cpp
View File

@ -380,12 +380,12 @@ void Clock::settingsStyle()
void Clock::iniWaylandWinId()
{
connect(WindowManager::self(),&WindowManager::windowAdded,this,[=](const WindowId& windowId){
qDebug()<< "getpid:"<<WindowManager::getPid(windowId);
qDebug()<< "this pid:"<<getpid();
if(getpid() == WindowManager::getPid(windowId))
{
m_pid = windowId.toULongLong();
if(m_first_pid){
m_pid = windowId.toULongLong();
m_first_pid=false;
}
}
});
}
@ -430,9 +430,9 @@ void Clock::buttonImageInit()
updateCountdownSelectBtnStyle(musicSelectOnCountdownRun,moveWidth,moveHeight);
//闹钟名称 新建闹钟
clockEditOnClockNew = new Btn_new( 0,tr(" name"),Btn_new::LINE_EDIT, ui->editAlarmPage);
updateCountdownSelectBtnStyle(clockEditOnClockNew,moveWidth,180);
updateCountdownSelectBtnStyle(clockEditOnClockNew,moveWidth,170);
//重复 新建闹钟
int selectHeight = 240;
int selectHeight = 230;
int selectGap = 60;
repeatSelectOnClockNew = new Btn_new( 0,tr(" repeat"),Btn_new::SELECT_BTN, ui->addAlarmPage);
updateClockSelectBtnStyle(repeatSelectOnClockNew,selectHeight);
@ -669,14 +669,14 @@ void Clock::setupInit()
//重复下拉框
int moreWidth = 20;
dialog_repeat = new set_alarm_repeat_Dialog(DIALOG_WIDTH+moreWidth,290,9,ui->editAlarmPage);dialog_repeat->hide();
dialog_repeat = new set_alarm_repeat_Dialog(DIALOG_WIDTH+moreWidth,368,9,ui->editAlarmPage);dialog_repeat->hide();
//铃声下拉框
int bellSize = m_selectBtnUtil->getBellListSize();
dialog_music = new set_alarm_repeat_Dialog(DIALOG_WIDTH+moreWidth,172,bellSize,ui->editAlarmPage);dialog_music->hide();
dialog_music = new set_alarm_repeat_Dialog(DIALOG_WIDTH+moreWidth,bellSize*36+40,bellSize,ui->editAlarmPage);dialog_music->hide();
//稍后提醒下拉框
dialog_remind_late = new set_alarm_repeat_Dialog(DIALOG_WIDTH+moreWidth,258,6,ui->editAlarmPage);dialog_remind_late->hide();
//倒计时铃声选择
count_music_sellect = new set_alarm_repeat_Dialog(DIALOG_WIDTH+moreWidth,172,bellSize,ui->countdownPage);count_music_sellect->hide();
count_music_sellect = new set_alarm_repeat_Dialog(DIALOG_WIDTH+moreWidth,bellSize*36+40,bellSize,ui->countdownPage);count_music_sellect->hide();
setMusicSelectDialogListById(bellId,count_music_sellect->listWidget);
//存储重复选择的星期,默认清零
@ -689,6 +689,22 @@ void Clock::setupInit()
connect(dialog_music->listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(musicListclickslot()));
connect(dialog_remind_late->listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(remindLateListClickSlot()));
connect(count_music_sellect->listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(countMusicListclickslot()));
connect(dialog_repeat->listWidget,&QListWidget::itemPressed,this,[=](QListWidgetItem *item){
int index = dialog_repeat->listWidget->row(item);
dialog_repeat->setLabelHoverStyle(index);
});
connect(dialog_music->listWidget,&QListWidget::itemPressed,this,[=](QListWidgetItem *item){
int index = dialog_music->listWidget->row(item);
dialog_music->setLabelHoverStyle(index);
});
connect(dialog_remind_late->listWidget,&QListWidget::itemPressed,this,[=](QListWidgetItem *item){
int index = dialog_remind_late->listWidget->row(item);
dialog_remind_late->setLabelHoverStyle(index);
});
connect(count_music_sellect->listWidget,&QListWidget::itemPressed,this,[=](QListWidgetItem *item){
int index = count_music_sellect->listWidget->row(item);
count_music_sellect->setLabelHoverStyle(index);
});
connect(dialog_repeat,&set_alarm_repeat_Dialog::dialogClose,this,[=](){
repeatSelectOnClockNew->updateIconLabel(0);
});
@ -1154,6 +1170,10 @@ void Clock::muteAllBell()
if(alarmNoticeDialog->m_musicPlayer->state()!= MMediaPlayer::State::PausedState)
alarmNoticeDialog->m_musicPlayer->pause();
}
//试听音乐开启静音
if(playController::getInstance().getState() == playController::PlayState::PLAY_STATE){
playController::getInstance().pause();
}
}else{
model_setup->setData(model_setup->index(0, 0), 0);//静音 Mute
if(countdownNoticeDialog->isVisible() == 1){
@ -1162,8 +1182,21 @@ void Clock::muteAllBell()
if(alarmNoticeDialog){
ringContinueWhenMute(alarmNoticeDialog);
}
}
model_setup->submitAll();
//试听音乐取消静音
auto sumtime = playController::getInstance().getPlayer()->duration();
QTime time = QTime::currentTime();
int timeH = time.hour()-musicStartTime.hour();
int timeM = time.minute()-musicStartTime.minute();
int timeS = time.second()-musicStartTime.second();
auto restarttime = (timeH*3600+timeM*60+timeS) * 1000;
if(playController::getInstance().getState() == playController::PlayState::PLAY_STATE){
playController::getInstance().getPlayer()->pause();
}
if(restarttime<sumtime){
playController::getInstance().getPlayer()->setPosition(restarttime);
}
}
model_setup->submitAll();
}
void Clock::ringContinueWhenMute(Natice_alarm *tempdialog)
@ -1171,7 +1204,7 @@ void Clock::ringContinueWhenMute(Natice_alarm *tempdialog)
auto startpos = tempdialog->timer_value * 1000;
auto starttime = 60000-startpos;
auto sumtime = tempdialog->m_musicPlayer->duration();
int num;
int num = 0;
if(tempdialog == countdownNoticeDialog){
num=count_music_sellect->listWidget->currentRow();
}else if(tempdialog == alarmNoticeDialog){
@ -1461,10 +1494,10 @@ void Clock::menuBtnStyle()
connect(m_aboutAction, &QAction::triggered, this, [=](){
About *dialog = new About();
QPointF position = this->pos();
// XAtomHelper::setStandardWindowHint(dialog->winId());
kdk::UkuiStyleHelper::self()->removeHeader(dialog);
dialog->show();
dialog->move(position.x()-15,position.y()+130);
dialog->showThisWindow();
QRect aboutRect = QRect(position.x()-15,position.y()+130,dialog->width(),dialog->height());
kdk::WindowManager::setGeometry(dialog->windowHandle(),aboutRect);
dialog->exec();
});
connect(m_closeAction, SIGNAL(triggered()), this, SLOT(windowClosingClicked()));
@ -1679,14 +1712,15 @@ void Clock::noticeDialogShow(int close_time, int alarm_num, QString id)
QScreen *screen=QGuiApplication::primaryScreen ();
//闹钟弹窗
alarmNoticeDialog = new Natice_alarm(close_time,alarm_num,nullptr,id);
alarmNoticeDialog->showThisWindow();
if(countdownNoticeDialog != nullptr) {
if (countdownNoticeDialog->isVisible() == 0)
moveUnderMultiScreen(UP_RIGHT,alarmNoticeDialog,1);
primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,alarmNoticeDialog,1);
else
moveUnderMultiScreen(UP_RIGHT,alarmNoticeDialog,0);
primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,alarmNoticeDialog,0);
}
else
moveUnderMultiScreen(UP_RIGHT,alarmNoticeDialog,1);
primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,alarmNoticeDialog,1);
alarmNoticeDialog->screenSaveStyle();
alarmNoticeDialog->playMusic();
}
@ -2481,9 +2515,11 @@ void Clock::countdownMusicSellect()
musicSelectOnCountdownSet->updateIconLabel(1);
musicSelectOnCountdownRun->updateIconLabel(1);
QPointF position = this->pos();
count_music_sellect->move(position.x()+DIALOG_MOVE_WIDTH,position.y()+482);
count_music_sellect->move(position.x()+DIALOG_MOVE_WIDTH-10,position.y()+464);
count_music_sellect->setWindowFlags(Qt::Popup);
refreshMusicSelectList(count_music_sellect);
int num = count_music_sellect->listWidget->currentRow();
count_music_sellect->setLabelHoverStyle(num);
count_music_sellect->show();
// connect(count_music_sellect->listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(countMusicListclickslot()));
}
@ -2528,8 +2564,13 @@ void Clock::playMusicFromPath(QString path)
// music->setMedia(QUrl::fromLocalFile(path));
// music->play();
playController::getInstance().playSingleSong(path,0);
if(m_muteOn){
playController::getInstance().playSingleSong(path,0);
playController::getInstance().pause();
}else{
playController::getInstance().playSingleSong(path,0);
}
musicStartTime = QTime::currentTime();
}
void Clock::stopHisPlay()
@ -2546,18 +2587,21 @@ void Clock::addDivBell(set_alarm_repeat_Dialog *tempDialog, btnType type)
qWarning()<<"dbq-开始复制"<<filePath;
//复制文件
QString toPatn = m_selectBtnUtil->copyAudioFile(filePath);
//存储到数据库
QString bellId = m_selectBtnUtil->saveToBellTable(toPatn);
QString name = m_selectBtnUtil->getBellNameById(bellId);
if(!toPatn.isEmpty()){
//存储到数据库
QString bellId = m_selectBtnUtil->saveToBellTable(toPatn);
QString name = m_selectBtnUtil->getBellNameById(bellId);
if(type==Clock::count_down){
musicSelectOnCountdownSet->textLabel->setText(name);
musicSelectOnCountdownRun->textLabel->setText(name);
}else{
musicSelectOnClockNew->textLabel->setText(name);
if(type==Clock::count_down){
musicSelectOnCountdownSet->textLabel->setText(name);
musicSelectOnCountdownRun->textLabel->setText(name);
}else{
musicSelectOnClockNew->textLabel->setText(name);
}
playMusicFromPath(toPatn);
}
playMusicFromPath(toPatn);
//刷新窗体
// rebuildCountdownMusicDialog();
//选中新建的铃声
@ -2731,14 +2775,15 @@ void Clock::countdownNoticeDialogShow()
countdownNoticeDialog->ui->autoCloseTime->setText(tr("60 Seconds to close"));
//左上图标
// countdownNoticeDialog->ui->titleLabel->setText(tr("Alarm"));
countdownNoticeDialog->showThisWindow();
//时间到
if (alarmNoticeDialog != nullptr) {
if (alarmNoticeDialog->isVisible() == 0)
moveUnderMultiScreen(UP_RIGHT,countdownNoticeDialog,1);
primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,countdownNoticeDialog,1);
else
moveUnderMultiScreen(UP_RIGHT,countdownNoticeDialog,0);
primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,countdownNoticeDialog,0);
} else
moveUnderMultiScreen(UP_RIGHT,countdownNoticeDialog,1);
primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,countdownNoticeDialog,1);
countdownNoticeDialog->screenSaveStyle();
countdownNoticeDialog->playMusic();
}
@ -2815,7 +2860,7 @@ void Clock::startbtnCountdown(){
void Clock::tinyCountdownFinish()
{
tinycountdownDia->hide();
tinycountdownDia->set_dialog_close();
activeWindow();
startbtnCountdown();
}
@ -2947,12 +2992,17 @@ void Clock::onTinyClicked()
//主窗体最小化
// kdk::WindowManager::minimizeWindow(m_pid);
setWindowState(Qt::WindowMinimized);
moveUnderMultiScreen(UP_RIGHT,tinycountdownDia,0);
tinycountdownDia->showThisWindow();
primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,tinycountdownDia,1);
}
void Clock::activeWindow()
{
kdk::WindowManager::activateWindow(m_pid);
if(primaryManager->checkWayland()){
kdk::WindowManager::activateWindow(m_pid);
}else{
setWindowState(Qt::WindowActive);
}
}
void Clock::showThisWindow()
{
@ -3083,6 +3133,10 @@ void Clock::countdownSetStartTime()
secondTimeRing = new VerticalScroll_60(ui->countdownSetPage);
QLabel * after_s = new QLabel (ui->countdownSetPage);
hourTimerRing->resize(60,228);
minuteTimeRing->resize(60,228);
secondTimeRing->resize(60,228);
h_in_m->resize(50,30);
h_in_m->setText(tr("hour"));
@ -3093,8 +3147,8 @@ void Clock::countdownSetStartTime()
after_s->resize(50,30);
after_s->setText(tr("sec"));
// after_s->setStyleSheet("font: 30pt 'Sans Serif';");
int ringMoveWidth = 73;
int ringMoveHeight = 45;
int ringMoveWidth = 67;
int ringMoveHeight = 30;
int timeSep = 100;
int labelSep = 55;
int timeLabelMoveHeight = 130;
@ -3131,6 +3185,34 @@ void Clock::countdownSetStartTime()
connect(timer_count_start, SIGNAL(timeout()), this, SLOT(countStatBtnGray()));
timer_count_start->setInterval(100);
timer_count_start->start();
connect(hourTimerRing,&VerticalScroll_99::BaseVerticalScroll::srcollDoubleClicked,this,[=](){
hourTimerRing->timeEdit_99->show();
});
connect(hourTimerRing->timeEdit_99,&QLineEdit::editingFinished,this,[=](){
int timevalue = hourTimerRing->timeEdit_99->text().toInt();
hourTimerRing->m_currentValue = timevalue;
hourTimerRing->homing();
hourTimerRing->timeEdit_99->hide();
});
connect(minuteTimeRing,&VerticalScroll_99::BaseVerticalScroll::srcollDoubleClicked,this,[=](){
minuteTimeRing->timeEdit_60->show();
});
connect(minuteTimeRing->timeEdit_60,&QLineEdit::editingFinished,this,[=](){
int timevalue = minuteTimeRing->timeEdit_60->text().toInt();
minuteTimeRing->m_currentValue = timevalue;
minuteTimeRing->homing();
minuteTimeRing->timeEdit_60->hide();
});
connect(secondTimeRing,&VerticalScroll_99::BaseVerticalScroll::srcollDoubleClicked,this,[=](){
secondTimeRing->timeEdit_60->show();
});
connect(secondTimeRing->timeEdit_60,&QLineEdit::editingFinished,this,[=](){
int timevalue = secondTimeRing->timeEdit_60->text().toInt();
secondTimeRing->m_currentValue = timevalue;
secondTimeRing->homing();
secondTimeRing->timeEdit_60->hide();
});
}
/*
@ -3245,7 +3327,7 @@ void Clock::updateFront(const int size)
}
void Clock::updateRepeatStr(QLabel *label){
if(Utils::checkLocalChina()){
updateLabelTextByLength(label,16);
updateLabelTextByLength(label,15);
}
if(Utils::checkLocalUs()){
updateLabelTextByLength(label,25);
@ -3287,8 +3369,8 @@ void Clock::alarmSetStartTime()
//闹钟分钟滚轮
timer_alarm_start60 = new VerticalScroll_60(ui->editAlarmPage);
timer_alarm_start24->resize(63,220);
timer_alarm_start60->resize(63,220);
timer_alarm_start24->resize(63,228);
timer_alarm_start60->resize(63,228);
QLabel * hour_ring = new QLabel (ui->editAlarmPage);
QLabel * min_ring = new QLabel (ui->editAlarmPage);
@ -3310,11 +3392,29 @@ void Clock::alarmSetStartTime()
min_ring->setText(tr("min"));
min_ring->setStyleSheet("font: 13pt ;color: rgb(148, 148, 148);");
int ringMoveHeight = -30;
timer_alarm_start24->move(124, ringMoveHeight);
timer_alarm_start24->move(116, ringMoveHeight);
hour_ring->move(140,7);
h_in_m->move(187,60);
timer_alarm_start60->move(196, ringMoveHeight);
h_in_m->move(189,60);
timer_alarm_start60->move(206, ringMoveHeight);
min_ring->move(212,7);
connect(timer_alarm_start24,&VerticalScroll_24::BaseVerticalScroll::srcollDoubleClicked,this,[=](){
timer_alarm_start24->timeEdit_24->show();
});
connect(timer_alarm_start24->timeEdit_24,&QLineEdit::editingFinished,this,[=](){
int timevalue = timer_alarm_start24->timeEdit_24->text().toInt();
timer_alarm_start24->m_currentValue = timevalue;
timer_alarm_start24->homing();
timer_alarm_start24->timeEdit_24->hide();
});
connect(timer_alarm_start60,&VerticalScroll_99::BaseVerticalScroll::srcollDoubleClicked,this,[=](){
timer_alarm_start60->timeEdit_60->show();
});
connect(timer_alarm_start60->timeEdit_60,&QLineEdit::editingFinished,this,[=](){
int timevalue = timer_alarm_start60->timeEdit_60->text().toInt();
timer_alarm_start60->m_currentValue = timevalue;
timer_alarm_start60->homing();
timer_alarm_start60->timeEdit_60->hide();
});
}
/*
@ -3332,7 +3432,7 @@ void Clock::alarmRepeat()
num= model->rowCount();
}
QPointF position = this->pos();//446
dialog_repeat->move(position.x()+DIALOG_MOVE_WIDTH,position.y()+420);
dialog_repeat->move(position.x()+DIALOG_MOVE_WIDTH-10,position.y()+382);
dialog_repeat->setWindowFlags(Qt::Popup);
dialog_repeat->widget[0]->alarmLabel0->setText(tr("No repetition"));
dialog_repeat->widget[1]->alarmLabel0->setText(tr("Workingday"));
@ -3519,23 +3619,24 @@ void Clock::selectAlarmMusic()
{
musicSelectOnClockNew->updateIconLabel(1);
QPointF position = this->pos();
dialog_music->move(position.x()+DIALOG_MOVE_WIDTH,position.y()+482);
dialog_music->move(position.x()+DIALOG_MOVE_WIDTH-10,position.y()+442);
dialog_music->setWindowFlags(Qt::Popup);
refreshMusicSelectList(dialog_music);
int num = dialog_music->listWidget->currentRow();
dialog_music->setLabelHoverStyle(num);
dialog_music->show();
}
void Clock::refreshMusicSelectList(set_alarm_repeat_Dialog *tempDialog)
{
// tempDialog = new
QList<QString> * bellList = m_selectBtnUtil->getAllBellItem();
int newSize = bellList->size();
int currentSize = tempDialog->rowNum_all;
if(currentSize<newSize){
for (int i=currentSize;i<newSize;i++) {
tempDialog->set_aItem(i);
}
tempDialog->rowNum_all=newSize;
for (int i=currentSize;i<newSize;i++) {
tempDialog->set_aItem(i,1);
}
}
for (int i=0;i<bellList->size();i++) {
tempDialog->widget[i]->alarmLabel0->setText(bellList->at(i));
@ -3550,7 +3651,7 @@ void Clock::selectRemindLate()
{
remindSelectOnClockNew->updateIconLabel(1);
QPointF position = this->pos();
dialog_remind_late->move(position.x()+DIALOG_MOVE_WIDTH,position.y()+510);
dialog_remind_late->move(position.x()+DIALOG_MOVE_WIDTH-10,position.y()+502);
dialog_remind_late->setWindowFlags(Qt::Popup);
dialog_remind_late->widget[0]->alarmLabel0->setText(tr("none"));
dialog_remind_late->widget[1]->alarmLabel0->setText(tr("five mins late"));
@ -3558,6 +3659,8 @@ void Clock::selectRemindLate()
dialog_remind_late->widget[3]->alarmLabel0->setText(tr("twenty mins late"));
dialog_remind_late->widget[4]->alarmLabel0->setText(tr("thirsty mins late"));
dialog_remind_late->widget[5]->alarmLabel0->setText(tr("one hour late"));
int num = dialog_remind_late->listWidget->currentRow();
dialog_remind_late->setLabelHoverStyle(num);
dialog_remind_late->show();
}
@ -3731,74 +3834,7 @@ void Clock::showPaint7()
painter.drawPath(painterPath);
}
}
/**
* @brief Natice_alarm移动
* @param spostion SP_LEFT SP_RIGHT SP_CENTER
* @param
*
* @return
*/
void Clock::moveUnderMultiScreen(Clock::ScreenPosition spostion,QWidget * tempDialog,int hiddenFlag)
{
tempDialog->hide();
kdk::UkuiStyleHelper::self()->removeHeader(tempDialog);
tempDialog->show();
QScreen *screen=QGuiApplication::primaryScreen ();
int screen_width = screen->geometry().width();
int screen_height = screen->geometry().height();
int x = primaryManager->getNScreen_x();
int y = primaryManager->getNScreen_y();
qWarning()<<"dbq-screen_width"<<screen_width<<"screen_height"<<screen_height<<"x"<<x<<"y"<<y;
int heightRadio = 20;
int widthRadio = 14;
int moveWidth = 0;
int moveHeight =0;
int diaWidth = tempDialog->width();
int diaHeight = tempDialog->height();
switch (spostion) {
case SP_LEFT:
{
moveWidth = x+round(tempDialog->width()+round(1.0/heightRadio*screen_width));
moveHeight = y+round(screen_height-tempDialog->height()-round(1.0/widthRadio*screen_height));
}break;
case SP_RIGHT:
{
moveWidth = x+round(screen_width-tempDialog->width());
moveHeight = y+round(screen_height-tempDialog->height()-50);
}break;
case SP_CENTER:
{
moveWidth = x+round((screen_width-tempDialog->width())*1.0/2);
moveHeight = y+round((screen_height-tempDialog->height())*1.0/2);
}break;
case UP_LEFT:
{
moveWidth = x+round(tempDialog->width()+round(1.0/heightRadio*screen_width));
moveHeight = y+round(tempDialog->height()+round(1.0/widthRadio*screen_height));
}break;
case UP_RIGHT:
{
moveWidth = x+round(screen_width-tempDialog->width()-round(1.0/heightRadio*screen_width));
moveHeight = y+round(1.0/20*screen_height);
}break;
case UP_CENTER:
{
moveWidth = x+round((screen_width-tempDialog->width())*1.0/2);
moveHeight = y+round((screen_height-tempDialog->height())*1.0/2);
}break;
default:
{}
}
if (hiddenFlag == 1){
kdk::WindowManager::setGeometry(tempDialog->windowHandle(),QRect(moveWidth,moveHeight,diaWidth,diaHeight));
}
else{
kdk::WindowManager::setGeometry(tempDialog->windowHandle(),QRect(moveWidth,moveHeight-tempDialog->height(),diaWidth,diaHeight));
}
}
void Clock::updateTinyBtn()

View File

@ -156,7 +156,6 @@ public:
count_down=1,
add_clock=2
};
void moveUnderMultiScreen(Clock::ScreenPosition,QWidget * dialog,int hiddenFlag); //多显示器下,位置移动
QString formatX_h(int x_h);
Ui::Clock *ui;
QString m_timeZone;
@ -531,7 +530,9 @@ private:
void setDefaultTrayIconTooltip();
int localeNumBack;
quint32 m_pid;
bool m_first_pid = true;
void iniWaylandWinId();
QTime musicStartTime;
};
#endif // CLOCK_H

View File

@ -1,2 +1,2 @@
[common]
version=3.1.4.0.0k0-0k0.3
version=3.1.4.0.0k0-0k0.4

17
debian/changelog vendored
View File

@ -1,3 +1,20 @@
ukui-clock (3.1.4.0.0k0-0k0.4) v101; urgency=medium
[ BUG 号 ]
* Closes: #
136675 【闹钟】弹出闹钟弹窗后点击"稍后提醒",之后再弹出的弹窗不显示在右上角
128359 【wayland】【闹钟】闹钟时间到弹出的闹铃弹窗不在页面右上方
[ 任务号]
-
[ 需求号]
-
[ 其他改动说明 ]
-
[ 影响域 ]
* 应用本身
-- daiboqi <daiboqi@kylinos.cn> Tue, 30 Aug 2022 19:49:23 +0800
ukui-clock (3.1.4.0.0k0-0k0.3) v101; urgency=medium
[ BUG 号 ]

Binary file not shown.

View File

@ -112,8 +112,14 @@ Natice_alarm::Natice_alarm(int close_time, int num, QWidget *parent , QString cl
//初始化使用不锁屏
this->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明
installEventFilter(this);
this->setWindowFlags(Qt::FramelessWindowHint|Qt::ToolTip); //设置无边框窗口
this->setAttribute(Qt::WA_AlwaysShowToolTips);
// this->setWindowFlags(Qt::FramelessWindowHint|Qt::ToolTip); //设置无边框窗口
// this->setAttribute(Qt::WA_AlwaysShowToolTips);
Qt::WindowFlags m_flags = windowFlags();
this->setWindowFlags(m_flags | Qt::WindowStaysOnTopHint);
// 添加窗管协议
// XAtomHelper::setStandardWindowHint(this->winId());
kdk::UkuiStyleHelper::self()->removeHeader(this);
m_primaryManager = new PrimaryManager();
}
@ -279,6 +285,7 @@ void Natice_alarm::showThisWindow()
{
kdk::UkuiStyleHelper::self()->removeHeader(this);
this->show();
m_primaryManager->moveUnderMultiScreen(PrimaryManager::UP_RIGHT,this,1);
}
void Natice_alarm::screenSaveStyle()
{
@ -314,13 +321,14 @@ void Natice_alarm::screenSaveStyle()
qDebug()<<"dbq-not lock";
}
}else{
this->setWindowFlags(Qt::WindowStaysOnTopHint);
Qt::WindowFlags m_flags = windowFlags();
this->setWindowFlags(m_flags | Qt::WindowStaysOnTopHint);
// 添加窗管协议
// XAtomHelper::setStandardWindowHint(this->winId());
kdk::UkuiStyleHelper::self()->removeHeader(this);
}
update();
this->show();
this->showThisWindow();
}
}

View File

@ -33,6 +33,7 @@
#include <QLabel>
#include "coreplayer/playcontroller.h"
#include <QDBusInterface>
#include "primarymanager.h"
namespace Ui {
class Natice_alarm;
}
@ -94,6 +95,7 @@ private:
int ring_num;
int timer_value2;
int full_flag=1;
PrimaryManager * m_primaryManager = nullptr;
QSqlTableModel *model_setup;
QPoint dragPosition; //拖动坐标
bool mousePressed; //鼠标是否按下

View File

@ -16,8 +16,8 @@
*
*/
#include "primarymanager.h"
#include "windowmanager/windowmanager.h"
#include <math.h>
PrimaryManager::PrimaryManager()
@ -182,6 +182,71 @@ int PrimaryManager::getNScreen_y() const
{
return m_nScreen_y;
}
/**
* @brief Natice_alarm移动
* @param spostion SP_LEFT SP_RIGHT SP_CENTER
* @param
*
* @return
*/
void PrimaryManager::moveUnderMultiScreen(PrimaryManager::ScreenPosition spostion,QWidget * tempDialog,int hiddenFlag)
{
QScreen *screen=QGuiApplication::primaryScreen ();
int screen_width = screen->geometry().width();
int screen_height = screen->geometry().height();
int x = getNScreen_x();
int y = getNScreen_y();
qWarning()<<"dbq-screen_width"<<screen_width<<"screen_height"<<screen_height<<"x"<<x<<"y"<<y;
int widthRadio = 20;
int heightRadio = 14;
int moveWidth = 0;
int moveHeight =0;
int diaWidth = tempDialog->width();
int diaHeight = tempDialog->height();
switch (spostion) {
case SP_LEFT:
{
moveWidth = x+round(tempDialog->width()+round(1.0/widthRadio*screen_width));
moveHeight = y+round(screen_height-tempDialog->height()-round(1.0/heightRadio*screen_height));
}break;
case SP_RIGHT:
{
moveWidth = x+round(screen_width-tempDialog->width());
moveHeight = y+round(screen_height-tempDialog->height()-50);
}break;
case SP_CENTER:
{
moveWidth = x+round((screen_width-tempDialog->width())*1.0/2);
moveHeight = y+round((screen_height-tempDialog->height())*1.0/2);
}break;
case UP_LEFT:
{
moveWidth = x+round(tempDialog->width()+round(1.0/widthRadio*screen_width));
moveHeight = y+round(tempDialog->height()+round(1.0/heightRadio*screen_height));
}break;
case UP_RIGHT:
{
moveWidth = x+round(screen_width-tempDialog->width()-round(1.0/widthRadio*screen_width));
moveHeight = y+round(1.0/20*screen_height);
}break;
case UP_CENTER:
{
moveWidth = x+round((screen_width-tempDialog->width())*1.0/2);
moveHeight = y+round((screen_height-tempDialog->height())*1.0/2);
}break;
default:
{}
}
QRect finalRect = QRect(moveWidth,moveHeight,diaWidth,diaHeight);
if (hiddenFlag == 0){
finalRect = QRect(moveWidth,moveHeight-tempDialog->height(),diaWidth,diaHeight);
}
qWarning()<<"dbq-finalRect"<<finalRect;
kdk::WindowManager::setGeometry(tempDialog->windowHandle(),finalRect);
}
/**
* @brief wayland
*/

View File

@ -50,6 +50,15 @@ public:
int getNScreen_y() const;
bool checkWayland();
enum ScreenPosition {
SP_LEFT = 1,
SP_CENTER = 2,
SP_RIGHT=3,
UP_LEFT=4,
UP_CENTER=5,
UP_RIGHT=6
};
void moveUnderMultiScreen(PrimaryManager::ScreenPosition spostion, QWidget *tempDialog, int hiddenFlag);
public slots:
void priScreenChanged(int x, int y, int width, int height);
private:

View File

@ -219,6 +219,9 @@ QString SelectBtnUtil::copyAudioFile(QString from)
QString to = path+fileName;
bool res = copyFile(from,to);
qWarning()<<"dbq-复制文件结束"<<res;
if(!res){
to = "";
}
return to;
}

View File

@ -60,7 +60,7 @@ set_alarm_repeat_Dialog::set_alarm_repeat_Dialog(int width, int Length, int rowN
setMask(bmp);
for (int i = 0; i < rowNum_all; i++) {
set_aItem(i);
set_aItem(i,0);
}
settingsStyle();
@ -114,7 +114,7 @@ void set_alarm_repeat_Dialog::updateLabelFront(QLabel *label, int size)
styleSheet.append("background-color: rgb();}");
label->setStyleSheet(styleSheet);
}
void set_alarm_repeat_Dialog::set_aItem(int rowNum)
void set_alarm_repeat_Dialog::set_aItem(int rowNum,int flags)
{
aItem[rowNum] =new QListWidgetItem;
//将列表项的大小提示设置为大小。如果未设置大小提示则item委托将基于item数据计算大小提示。
@ -127,6 +127,40 @@ void set_alarm_repeat_Dialog::set_aItem(int rowNum)
listWidget->setItemWidget(aItem[rowNum],widget[rowNum]);
QScroller::grabGesture(listWidget,QScroller::LeftMouseButtonGesture); //设置鼠标左键拖动
listWidget -> setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); // 设置像素级滑动
if(flags){
Length_num = rowNum_all*36+40;
this->resize(width_num, Length_num);
//增加圆角
QBitmap bmp(this->size());
bmp.fill();
QPainter p(&bmp);
p.setPen(Qt::black);
p.setBrush(Qt::black);
p.setRenderHint(QPainter::Antialiasing);
p.drawRoundedRect(bmp.rect(),10,10);
setMask(bmp);
}
listWidget->setGeometry(QRect(0, 0, width_num-20, Length_num-22));
//消除不使用样式表后直角和圆角重叠影响
listWidget->setFrameShape(QListWidget::NoFrame);
listWidget->move(10,10);
}
void set_alarm_repeat_Dialog::setLabelHoverStyle(int num)
{
for (int i = 0;i<rowNum_all;i++) {
auto item = this->widget[i];
if(i==num){
QPalette ptext;
ptext.setColor(QPalette::Text,Qt::white);
item->alarmLabel0->setPalette(ptext);
}else{
QPalette ptext;
ptext.setColor(QPalette::Text,Qt::black);
item->alarmLabel0->setPalette(ptext);
}
}
}
void set_alarm_repeat_Dialog::setupUi(QWidget( *set_alarm_repeat_Dialog))
@ -135,7 +169,9 @@ void set_alarm_repeat_Dialog::setupUi(QWidget( *set_alarm_repeat_Dialog))
set_alarm_repeat_Dialog->setObjectName(QString::fromUtf8("set_alarm_repeat_Dialog"));
listWidget = new QListWidget(set_alarm_repeat_Dialog);
listWidget->setObjectName(QString::fromUtf8("listWidget"));
listWidget->setGeometry(QRect(0, 0, width_num-20, Length_num-20));
listWidget->setGeometry(QRect(0, 0, width_num-20, Length_num-22));
//消除不使用样式表后直角和圆角重叠影响
listWidget->setFrameShape(QListWidget::NoFrame);
listWidget->move(10,10);
retranslateUi(set_alarm_repeat_Dialog);
@ -204,21 +240,21 @@ void set_alarm_repeat_Dialog::closeEvent(QCloseEvent *event)
//黑色主题
void set_alarm_repeat_Dialog::blackStyle()
{
QString itemRadius = QString::number(ITEM_RADIUS);
listWidget->setStyleSheet("QListWidget{background-color: rgba(0, 0, 0, 0);}\
QListWidget::item::selected{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;border:1px solid rgba(131, 131, 131,0);}\
QListWidget::item:hover{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;}\
");
// QString itemRadius = QString::number(ITEM_RADIUS);
// listWidget->setStyleSheet("QListWidget{background-color: rgba(0, 0, 0, 0);}\
// QListWidget::item::selected{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;border:1px solid rgba(131, 131, 131,0);}\
// QListWidget::item:hover{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;}\
// ");
}
//白色主题
void set_alarm_repeat_Dialog::whiteStyle()
{
QString itemRadius = QString::number(ITEM_RADIUS);
listWidget->setStyleSheet("QListWidget{background-color: rgba(0, 0, 0, 0);}\
QListWidget::item::selected{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;border:1px solid rgba(131, 131, 131,0);}\
QListWidget::item:hover{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;}\
");
// QString itemRadius = QString::number(ITEM_RADIUS);
// listWidget->setStyleSheet("QListWidget{background-color: rgba(0, 0, 0, 0);}\
// QListWidget::item::selected{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;border:1px solid rgba(131, 131, 131,0);}\
// QListWidget::item:hover{background-color:rgba("+hoverColor+");border-radius:"+itemRadius+"px;}\
// ");
}

View File

@ -50,7 +50,8 @@ public:
int rowNum_all ;
int width_num, Length_num;
QListWidget *listWidget;
void set_aItem(int rowNum);
void set_aItem(int rowNum,int flags);
void setLabelHoverStyle(int num);
protected:
void closeEvent(QCloseEvent *event) override;

View File

@ -51,15 +51,20 @@ void tinyCountdown::updateWidgetRadius()
{
this->setAttribute(Qt::WA_TranslucentBackground);//设置窗口背景透明
#ifdef onTooltip
this->setWindowFlags(Qt::FramelessWindowHint|Qt::ToolTip); //设置无边框窗口
this->setAttribute(Qt::WA_AlwaysShowToolTips);
// Qt::WindowFlags m_flags = windowFlags();
// this->setWindowFlags(m_flags | Qt::WindowStaysOnTopHint);
#else
Qt::WindowFlags m_flags = windowFlags();
this->setWindowFlags(m_flags | Qt::WindowStaysOnTopHint);
#endif
// 添加窗管协议
// XAtomHelper::setStandardWindowHint(this->winId());
kdk::UkuiStyleHelper::self()->removeHeader(this);
// kdk::UkuiStyleHelper::self()->removeHeader(this);
//圆角
#ifdef onTooltip
QBitmap bmp(this->size());
bmp.fill();
QPainter p(&bmp);
@ -68,6 +73,13 @@ void tinyCountdown::updateWidgetRadius()
p.setBrush(palette().color(QPalette::Base));
p.drawRoundedRect(bmp.rect(),WINDOWN_RADIUS,WINDOWN_RADIUS);
setMask(bmp);
#endif
}
void tinyCountdown::showThisWindow()
{
kdk::UkuiStyleHelper::self()->removeHeader(this);
this->show();
}
tinyCountdown::~tinyCountdown()
@ -95,6 +107,7 @@ void tinyCountdown::focusInEvent(QFocusEvent *event)
qDebug()<<"dbq-"<<"focusInEvent";
}
*/
#ifdef onTooltip
// 在鼠标光标在小部件内部时按下鼠标按钮时调用或者当小部件使用grabMouse ()抓住鼠标时调用。按下鼠标而不释放它实际上与调用grabMouse ()相同。
void tinyCountdown::mousePressEvent(QMouseEvent *event)
{
@ -118,26 +131,24 @@ void tinyCountdown::mouseReleaseEvent(QMouseEvent *event)
//每当鼠标移动而按住鼠标按钮时调用。这在拖放操作期间很有用。
void tinyCountdown::mouseMoveEvent(QMouseEvent *event)
{
if (this->mousePressed) {
move(event->globalPos() - this->dragPosition);
this->setCursor(Qt::ClosedHandCursor);
}
QWidget::mouseMoveEvent(event);
}
#endif
void tinyCountdown::closeEvent(QCloseEvent *event)
{
event->ignore();//忽视
this->hide();
this->set_dialog_close();
}
void tinyCountdown::paintEvent(QPaintEvent * event)
{
#ifdef onTooltip
Q_UNUSED(event);
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
@ -179,6 +190,15 @@ void tinyCountdown::paintEvent(QPaintEvent * event)
p.setBrush(palette().color(QPalette::Base));
p.drawPath(rectPath);
p.restore();
#else
Q_UNUSED(event);
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
//绘制器路径
QPainterPath rectPath;
rectPath.addRect(this->rect());
p.fillPath(rectPath,palette().color(QPalette::Base));
#endif
}
@ -190,7 +210,7 @@ void tinyCountdown::paintEvent(QPaintEvent * event)
void tinyCountdown::clearData()
{
ui->timeLabel->setText("00:00:00");
this->hide();
this->set_dialog_close();
updateOnRunState(true);
}
@ -203,7 +223,7 @@ void tinyCountdown::set_dialog_close()
void tinyCountdown::showMainWindow()
{
this->hide();
this->set_dialog_close();
emit mainWindowClick();
}
@ -211,7 +231,7 @@ void tinyCountdown::showMainWindow()
void tinyCountdown::showTop()
{
this->hide();
this->set_dialog_close();
this->update();
this->show();
}

View File

@ -38,16 +38,16 @@ class tinyCountdown;
class tinyCountdown : public QWidget
{
Q_OBJECT
//#define onTooltip
public:
explicit tinyCountdown(QWidget *parent = nullptr);
~tinyCountdown();
void updateTimeInfo(QString str);
#ifdef onTooltip
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
#endif
/*
void focusOutEvent ( QFocusEvent * event ) override;
void focusInEvent ( QFocusEvent * event ) override;
@ -56,7 +56,7 @@ public:
void closeEvent(QCloseEvent *event) override;
void paintEvent(QPaintEvent * event) override;
void updateWidgetRadius();
void showThisWindow();
void clearData();
protected:
//绘制背景

View File

@ -6,20 +6,20 @@
<rect>
<x>0</x>
<y>0</y>
<width>336</width>
<height>62</height>
<width>320</width>
<height>50</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>336</width>
<height>62</height>
<width>320</width>
<height>46</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>336</width>
<height>62</height>
<width>320</width>
<height>50</height>
</size>
</property>
<property name="windowTitle">

View File

@ -30,11 +30,13 @@ VerticalScroll_24::VerticalScroll_24(QWidget *parent, Clock *clock) :
homingAni = new QPropertyAnimation(this, "deviation");
homingAni->setDuration(300);
homingAni->setEasingCurve(QEasingCurve::OutQuad);
timeEditStyle_24();
}
VerticalScroll_24::~VerticalScroll_24()
{
delete homingAni;
delete timeEdit_24;
qDebug()<<"-------VerticalScroll_24---------";
//delete ui;
@ -61,6 +63,20 @@ int VerticalScroll_24::readValue()
return m_currentValue;
}
void VerticalScroll_24::timeEditStyle_24()
{
timeEdit_24 = new QLineEdit(this);
timeEdit_24->resize(52,54);
timeEdit_24->move(3,height()/2-15);
QRegExp rx = QRegExp("^(((0|1)[0-9])|20|21|22|23|[0-9]|"")$");
QRegExpValidator* validator = new QRegExpValidator(rx);
timeEdit_24->setValidator(validator);
QFont font;
font.setPixelSize(34);
timeEdit_24->setFont(font);
timeEdit_24->hide();
}
//鼠标按压选择当前值
// Press the mouse to select the current value
void VerticalScroll_24::mousePressEvent(QMouseEvent *e)
@ -87,6 +103,7 @@ void VerticalScroll_24::mouseReleaseEvent(QMouseEvent *)
//绘制当前数值轮画面
// Draw the current numerical wheel screen
void VerticalScroll_24::paintEvent(QPaintEvent *)

View File

@ -22,6 +22,7 @@
#include <QPropertyAnimation>
#include <QPainter>
#include <QStyleOption>
#include <QLineEdit>
#include "baseverticalscroll.h"
namespace Ui {
@ -48,6 +49,8 @@ public:
//获取当前值
// Get current value
int readValue();
QLineEdit *timeEdit_24;
void timeEditStyle_24();
Clock *m_Pclock;
protected:

View File

@ -30,11 +30,13 @@ VerticalScroll_60::VerticalScroll_60(QWidget *parent) :
homingAni = new QPropertyAnimation(this, "deviation");
homingAni->setDuration(300);
homingAni->setEasingCurve(QEasingCurve::OutQuad);
timeEditStyle_60();
}
VerticalScroll_60::~VerticalScroll_60()
{
delete homingAni;
delete timeEdit_60;
qDebug()<<"-------VerticalScroll_60---------";
//delete ui;
@ -62,6 +64,20 @@ int VerticalScroll_60::readValue()
return m_currentValue;
}
void VerticalScroll_60::timeEditStyle_60()
{
timeEdit_60 = new QLineEdit(this);
timeEdit_60->resize(52,54);
timeEdit_60->move(3,height()/2-15);
QRegExp rx = QRegExp("^(([0-5][0-9])|[0-9]|"")$");
QRegExpValidator* validator = new QRegExpValidator(rx);
timeEdit_60->setValidator(validator);
QFont font;
font.setPixelSize(34);
timeEdit_60->setFont(font);
timeEdit_60->hide();
}
void VerticalScroll_60::mousePressEvent(QMouseEvent *e)
{
qDebug()<<"mouse pressed on vertical scroll";

View File

@ -50,6 +50,9 @@ public:
// Get current value
int readValue();
QLineEdit *timeEdit_60;
void timeEditStyle_60();
void setupUi(QWidget *VerticalScroll_60);
void retranslateUi(QWidget *VerticalScroll_60);

View File

@ -33,6 +33,7 @@ VerticalScroll_99::VerticalScroll_99(QWidget *parent) :
timer_21111 = new QTimer();
connect(timer_21111, SIGNAL(timeout()), this, SLOT(listClickslot()));
timer_21111->setInterval(1000);
timeEditStyle_99();
qDebug() << m_currentValue;
}
@ -40,6 +41,7 @@ VerticalScroll_99::~VerticalScroll_99()
{
delete timer_21111;
delete homingAni;
delete timeEdit_99;
qDebug()<<"-------VerticalScroll_99---------";
}
@ -66,6 +68,20 @@ int VerticalScroll_99::readValue()
return m_currentValue;
}
void VerticalScroll_99::timeEditStyle_99()
{
timeEdit_99 = new QLineEdit(this);
timeEdit_99->resize(52,54);
timeEdit_99->move(3,height()/2-15);
QRegExp rx = QRegExp("^(((0|1)[0-9])|20|21|22|23|[0-9]|"")$");
QRegExpValidator* validator = new QRegExpValidator(rx);
timeEdit_99->setValidator(validator);
QFont font;
font.setPixelSize(34);
timeEdit_99->setFont(font);
timeEdit_99->hide();
}
void VerticalScroll_99::listClickslot()
{
qDebug() << m_currentValue;

View File

@ -23,6 +23,7 @@
#include <QPainter>
#include <QTimer>
#include <QStyleOption>
#include <QLineEdit>
#include "baseverticalscroll.h"
namespace Ui {
@ -51,6 +52,9 @@ public:
// Get current value
int readValue();
QLineEdit *timeEdit_99;
void timeEditStyle_99();
void setupUi(QWidget *VerticalScroll_99);
void retranslateUi(QWidget *VerticalScroll_99);