Cocoa: Implement propagateSizeHints.
Change-Id: Idc1244ffbf975972f01d9ee48092500a72739d37 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
parent
af8795c2b5
commit
db44fdf4d6
@ -77,6 +77,8 @@ CGImageRef qt_mac_image_to_cgimage(const QImage &image);
|
||||
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);
|
||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
||||
|
||||
NSSize qt_mac_toNSSize(const QSize &qtSize);
|
||||
|
||||
QChar qt_mac_qtKey2CocoaKey(Qt::Key key);
|
||||
Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode);
|
||||
|
||||
|
@ -128,6 +128,10 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm)
|
||||
return qt_mac_cgimage_to_nsimage(qt_mac_image_to_cgimage(image));
|
||||
}
|
||||
|
||||
NSSize qt_mac_toNSSize(const QSize &qtSize)
|
||||
{
|
||||
return NSMakeSize(qtSize.width(), qtSize.height());
|
||||
}
|
||||
|
||||
// Use this method to keep all the information in the TextSegment. As long as it is ordered
|
||||
// we are in OK shape, and we can influence that ourselves.
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
void raise();
|
||||
void lower();
|
||||
|
||||
void propagateSizeHints();
|
||||
|
||||
WId winId() const;
|
||||
NSView *contentView() const;
|
||||
|
||||
|
@ -140,6 +140,26 @@ void QCocoaWindow::lower()
|
||||
[m_nsWindow orderFront: m_nsWindow];
|
||||
}
|
||||
|
||||
void QCocoaWindow::propagateSizeHints()
|
||||
{
|
||||
[m_nsWindow setMinSize : qt_mac_toNSSize(window()->minimumSize())];
|
||||
[m_nsWindow setMaxSize : qt_mac_toNSSize(window()->maximumSize())];
|
||||
|
||||
if (!window()->sizeIncrement().isNull())
|
||||
[m_nsWindow setResizeIncrements : qt_mac_toNSSize(window()->sizeIncrement())];
|
||||
|
||||
// We must set the window frame after setting the minimum size to prevent the window
|
||||
// from being resized to the minimum size. Use QWindow::baseSize if set, otherwise
|
||||
// use the current size.
|
||||
QSize baseSize = window()->baseSize();
|
||||
QRect rect = geometry();
|
||||
if (!baseSize.isNull()) {
|
||||
[m_nsWindow setFrame : NSMakeRect(rect.x(), rect.y(), baseSize.width(), baseSize.height()) display : YES];
|
||||
} else {
|
||||
[m_nsWindow setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()) display : YES];
|
||||
}
|
||||
}
|
||||
|
||||
WId QCocoaWindow::winId() const
|
||||
{
|
||||
return WId(m_nsWindow);
|
||||
|
Loading…
Reference in New Issue
Block a user