2022-10-07 09:08:10 +00:00
|
|
|
#include "utils.hh"
|
|
|
|
#include <QDir>
|
2023-03-22 01:01:22 +00:00
|
|
|
#include <QPalette>
|
|
|
|
#include <QStyle>
|
2022-10-07 09:08:10 +00:00
|
|
|
|
|
|
|
QString Utils::Path::combine(const QString& path1, const QString& path2)
|
|
|
|
{
|
|
|
|
return QDir::cleanPath(path1 + QDir::separator() + path2);
|
|
|
|
}
|
2022-10-15 05:58:24 +00:00
|
|
|
|
|
|
|
QString Utils::Url::getSchemeAndHost( QUrl const & url )
|
|
|
|
{
|
|
|
|
auto _url = url.url();
|
|
|
|
auto index = _url.indexOf("://");
|
|
|
|
auto hostEndIndex = _url.indexOf("/",index+3);
|
|
|
|
return _url.mid(0,hostEndIndex);
|
|
|
|
}
|
2023-03-22 01:01:22 +00:00
|
|
|
|
|
|
|
void Utils::Widget::setNoResultColor(QWidget * widget, bool noResult)
|
|
|
|
{
|
|
|
|
if( noResult ) {
|
|
|
|
QPalette pal( widget->palette() );
|
|
|
|
// #febb7d
|
|
|
|
QRgb rgb = 0xfebb7d;
|
|
|
|
pal.setColor( QPalette::Base, QColor( rgb ) );
|
|
|
|
widget->setAutoFillBackground( true );
|
|
|
|
widget->setPalette( pal );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
QPalette pal( widget->style()->standardPalette() );
|
|
|
|
widget->setAutoFillBackground( true );
|
|
|
|
widget->setPalette( pal );
|
|
|
|
}
|
|
|
|
}
|