mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
improve UI styles
- Added album path management in PhotoModel for better photo loading. - Updated responsive QLabel to handle scaling more effectively. - Introduced ClickableIconWidget for better icon interaction in the UI. - Added new color definitions for blue and accent blue. - Enhanced the AppTabWidget styles to adapt to dark mode. - Replaced QLineEdit with ZLineEdit for consistent styling. - Improved the SSH terminal widget with better error handling and process management. - Refactored ToolboxWidget methods for device management. - Adjusted margins and styles in various widgets for improved layout.
This commit is contained in:
@@ -6,7 +6,7 @@ ResponsiveQLabel::ResponsiveQLabel(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
setAlignment(Qt::AlignCenter);
|
||||
setScaledContents(false);
|
||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding);
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setMinimumSize(100, 100);
|
||||
}
|
||||
|
||||
@@ -44,13 +44,23 @@ void ResponsiveQLabel::paintEvent(QPaintEvent *event)
|
||||
|
||||
void ResponsiveQLabel::updateScaledPixmap()
|
||||
{
|
||||
if (m_originalPixmap.isNull() || size().isEmpty()) {
|
||||
if (m_originalPixmap.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the minimum width as the constraint for scaling
|
||||
int targetWidth = qMax(minimumWidth(), width());
|
||||
|
||||
// Scale the pixmap while maintaining aspect ratio
|
||||
m_scaledPixmap = m_originalPixmap.scaled(size(), Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation);
|
||||
m_scaledPixmap =
|
||||
m_originalPixmap.scaled(targetWidth, QWIDGETSIZE_MAX,
|
||||
Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
// Resize the widget to match the scaled pixmap size
|
||||
// This prevents the widget from taking up more space than the actual image
|
||||
if (!m_scaledPixmap.isNull()) {
|
||||
setFixedSize(m_scaledPixmap.size());
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
Reference in New Issue
Block a user