Changeset 124 for trunk/src/gui/kernel/qwidget_pm.cpp
- Timestamp:
- Aug 21, 2009, 3:34:10 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qwidget_pm.cpp
r123 r124 1920 1920 int QWidget::metric(PaintDeviceMetric m) const 1921 1921 { 1922 // @todo implement 1923 return 0; 1922 Q_D(const QWidget); 1923 LONG val; 1924 if (m == PdmWidth) { 1925 val = data->crect.width(); 1926 } else if (m == PdmHeight) { 1927 val = data->crect.height(); 1928 } else { 1929 HDC hdc = GpiQueryDevice(qt_display_ps()); 1930 switch (m) { 1931 case PdmDpiX: 1932 case PdmPhysicalDpiX: 1933 if (d->extra && d->extra->customDpiX) 1934 val = d->extra->customDpiX; 1935 else if (d->parent) 1936 val = static_cast<QWidget *>(d->parent)->metric(m); 1937 else 1938 DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 1, &val); 1939 break; 1940 case PdmDpiY: 1941 case PdmPhysicalDpiY: 1942 if (d->extra && d->extra->customDpiY) 1943 val = d->extra->customDpiY; 1944 else if (d->parent) 1945 val = static_cast<QWidget *>(d->parent)->metric(m); 1946 else 1947 DevQueryCaps(hdc, CAPS_VERTICAL_FONT_RES, 1, &val); 1948 break; 1949 case PdmWidthMM: 1950 DevQueryCaps(hdc, CAPS_HORIZONTAL_RESOLUTION, 1, &val); 1951 val = data->crect.width() * 1000 / val; 1952 break; 1953 case PdmHeightMM: 1954 DevQueryCaps(hdc, CAPS_VERTICAL_RESOLUTION, 1, &val); 1955 val = data->crect.height() * 1000 / val; 1956 break; 1957 case PdmNumColors: 1958 DevQueryCaps(hdc, CAPS_COLORS, 1, &val); 1959 break; 1960 case PdmDepth: 1961 LONG colorInfo[2]; 1962 DevQueryCaps(hdc, CAPS_COLOR_PLANES, 2, colorInfo); 1963 val = colorInfo[0] * colorInfo[1]; 1964 break; 1965 default: 1966 val = 0; 1967 qWarning("QWidget::metric: Invalid metric command"); 1968 } 1969 } 1970 return val; 1924 1971 } 1925 1972
Note:
See TracChangeset
for help on using the changeset viewer.