Changeset 769 for trunk/src/gui/itemviews
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/itemviews/qabstractitemview.cpp
r651 r769 1541 1541 d->doDelayedItemsLayout(); // the size of the items will change 1542 1542 break; 1543 #ifdef QT_SOFTKEYS_ENABLED 1544 case QEvent::LanguageChange: 1545 d->doneSoftKey->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::DoneSoftKey)); 1546 break; 1547 #endif 1543 1548 default: 1544 1549 break; … … 1781 1786 if (edited) 1782 1787 return; 1783 if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)) 1788 QStyleOptionViewItemV4 option = d->viewOptionsV4(); 1789 if (d->pressedAlreadySelected) 1790 option.state |= QStyle::State_Selected; 1791 if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this)) 1784 1792 emit activated(index); 1785 1793 } … … 2115 2123 QAbstractScrollArea::focusOutEvent(event); 2116 2124 d->viewport->update(); 2125 2126 #ifdef QT_SOFTKEYS_ENABLED 2127 if(!hasEditFocus()) 2128 removeAction(d->doneSoftKey); 2129 #endif 2117 2130 } 2118 2131 … … 2140 2153 setEditFocus(true); 2141 2154 #ifdef QT_SOFTKEYS_ENABLED 2142 addAction(d->doneSoftKey); 2155 // If we can't keypad navigate to any direction, there is no sense to add 2156 // "Done" softkey, since it basically does nothing when there is 2157 // only one widget in screen 2158 if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) 2159 || QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) 2160 addAction(d->doneSoftKey); 2143 2161 #endif 2144 2162 return; … … 2156 2174 } 2157 2175 return; 2176 case Qt::Key_Down: 2177 case Qt::Key_Up: 2178 // Let's ignore vertical navigation events, only if there is no other widget 2179 // what can take the focus in vertical direction. This means widget can handle navigation events 2180 // even the widget don't have edit focus, and there is no other widget in requested direction. 2181 if(QApplication::keypadNavigationEnabled() && !hasEditFocus() 2182 && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { 2183 event->ignore(); 2184 return; 2185 } 2186 break; 2187 case Qt::Key_Left: 2188 case Qt::Key_Right: 2189 // Similar logic as in up and down events 2190 if(QApplication::keypadNavigationEnabled() && !hasEditFocus() 2191 && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) { 2192 event->ignore(); 2193 return; 2194 } 2195 break; 2158 2196 default: 2159 2197 if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { … … 2241 2279 case Qt::Key_Up: 2242 2280 #ifdef QT_KEYPAD_NAVIGATION 2243 if (QApplication::keypadNavigationEnabled() ) {2281 if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { 2244 2282 event->accept(); // don't change focus 2245 2283 break; … … 2249 2287 case Qt::Key_Right: 2250 2288 #ifdef QT_KEYPAD_NAVIGATION 2251 if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) { 2252 event->accept(); // don't change horizontal focus in directional mode 2289 if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional 2290 && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) 2291 || (QWidgetPrivate::inTabWidget(this) && d->model->columnCount(d->root) > 1))) { 2292 event->accept(); // don't change focus 2253 2293 break; 2254 2294 } … … 2532 2572 QList<QEditorInfo>::iterator it = d->editors.begin(); 2533 2573 QWidgetList editorsToRelease; 2574 QWidgetList editorsToHide; 2534 2575 while (it != d->editors.end()) { 2535 2576 QModelIndex index = it->index; … … 2543 2584 delegate->updateEditorGeometry(editor, option, index); 2544 2585 } else { 2545 editor ->hide();2586 editorsToHide << editor; 2546 2587 } 2547 2588 ++it; … … 2552 2593 } 2553 2594 2554 //we release the editor outside of the loop because it might change the focus and try2595 //we hide and release the editor outside of the loop because it might change the focus and try 2555 2596 //to change the d->editors list. 2597 for (int i = 0; i < editorsToHide.count(); ++i) { 2598 editorsToHide.at(i)->hide(); 2599 } 2556 2600 for (int i = 0; i < editorsToRelease.count(); ++i) { 2557 2601 d->releaseEditor(editorsToRelease.at(i)); … … 3010 3054 return; 3011 3055 if (QWidget *oldWidget = indexWidget(index)) { 3056 d->persistent.remove(oldWidget); 3012 3057 d->removeEditor(oldWidget); 3013 3058 oldWidget->deleteLater(); -
trunk/src/gui/itemviews/qabstractproxymodel.cpp
r651 r769 128 128 d->model = QAbstractItemModelPrivate::staticEmptyModel(); 129 129 } 130 d->roleNames = d->model->roleNames(); 130 131 } 131 132 -
trunk/src/gui/itemviews/qfileiconprovider.cpp
r651 r769 69 69 #ifndef SHGFI_ADDOVERLAYS 70 70 # define SHGFI_ADDOVERLAYS 0x000000020 71 # define SHGFI_OVERLAYINDEX 0x000000040 71 72 #endif 72 73 … … 254 255 #ifndef Q_OS_WINCE 255 256 val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, 256 sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS );257 sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX); 257 258 #else 258 259 val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, 259 260 sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_SYSICONINDEX); 260 261 #endif 261 if (val) { 262 263 // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases 264 if (val && info.hIcon) { 262 265 if (fileInfo.isDir() && !fileInfo.isRoot()) { 263 266 //using the unique icon index provided by windows save us from duplicate keys … … 293 296 #ifndef Q_OS_WINCE 294 297 val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, 295 sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_LARGEICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS );298 sizeof(SHFILEINFO), SHGFI_ICON|SHGFI_LARGEICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX); 296 299 #else 297 300 val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info, 298 301 sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX); 299 302 #endif 300 if (val ) {303 if (val && info.hIcon) { 301 304 if (fileInfo.isDir() && !fileInfo.isRoot()) { 302 305 //using the unique icon index provided by windows save us from duplicate keys -
trunk/src/gui/itemviews/qitemdelegate.cpp
r651 r769 1034 1034 } 1035 1035 1036 return QString ::fromUtf16(ptr, int(&arr[sizeof(arr) / sizeof(ushort)] - ptr));1036 return QString((const QChar *)ptr, int(&arr[sizeof(arr) / sizeof(ushort)] - ptr)); 1037 1037 } 1038 1038 … … 1298 1298 } 1299 1299 1300 Qt::CheckState state; 1301 if ( flags & Qt::ItemIsTristate ) { 1302 state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 ); 1303 } else { 1304 state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked 1300 Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked 1305 1301 ? Qt::Unchecked : Qt::Checked); 1306 }1307 1308 1302 return model->setData(index, state, Qt::CheckStateRole); 1309 1303 } -
trunk/src/gui/itemviews/qlistview.cpp
r651 r769 2161 2161 if (flowPositions.isEmpty()) 2162 2162 return; 2163 const int max = flowPositions.count() - 1;2163 const int max = scrollValueMap.count() - 1; 2164 2164 if (vertical && flow() == QListView::TopToBottom && dy != 0) { 2165 2165 int currentValue = qBound(0, verticalValue, max); -
trunk/src/gui/itemviews/qstyleditemdelegate.cpp
r651 r769 748 748 } 749 749 750 Qt::CheckState state; 751 if ( flags & Qt::ItemIsTristate ) { 752 state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 ); 753 } else { 754 state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked 750 Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked 755 751 ? Qt::Unchecked : Qt::Checked); 756 }757 752 return model->setData(index, state, Qt::CheckStateRole); 758 753 } -
trunk/src/gui/itemviews/qtableview.cpp
r651 r769 115 115 } else if (old_height > span->height()) { 116 116 //remove the span from all the subspans lists that intersect the columns not covered anymore 117 Index::iterator it_y = index.lowerBound(-span->bottom()); 118 if (it_y == index.end()) 119 it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it. 117 Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0 120 118 Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list 121 119 while (-it_y.key() <= span->top() + old_height -1) { 122 120 if (-it_y.key() > span->bottom()) { 123 (*it_y).remove(-span->left()); 121 int removed = (*it_y).remove(-span->left()); 122 Q_ASSERT(removed == 1); Q_UNUSED(removed); 124 123 if (it_y->isEmpty()) { 125 it_y = index.erase(it_y) - 1;124 it_y = index.erase(it_y); 126 125 } 127 126 } … … 1909 1908 } 1910 1909 } else { // nothing moved 1910 const int gridAdjust = showGrid() ? 1 : 0; 1911 1911 for (int i = 0; i < selection.count(); ++i) { 1912 1912 QItemSelectionRange range = selection.at(i); … … 1917 1917 const int rtop = rowViewportPosition(range.top()); 1918 1918 const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom()); 1919 const int rleft = columnViewportPosition(range.left()); 1920 const int rright = columnViewportPosition(range.right()) + columnWidth(range.right()); 1921 selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright, rbottom)); 1919 int rleft; 1920 int rright; 1921 if (isLeftToRight()) { 1922 rleft = columnViewportPosition(range.left()); 1923 rright = columnViewportPosition(range.right()) + columnWidth(range.right()); 1924 } else { 1925 rleft = columnViewportPosition(range.right()); 1926 rright = columnViewportPosition(range.left()) + columnWidth(range.left()); 1927 } 1928 selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust)); 1922 1929 if (d->hasSpans()) { 1923 1930 foreach (QSpanCollection::Span *s, … … 2547 2554 if (!d->isIndexValid(index) 2548 2555 || (d->model->parent(index) != d->root) 2549 || is IndexHidden(index))2556 || isRowHidden(index.row()) || isColumnHidden(index.column())) 2550 2557 return; 2551 2558 -
trunk/src/gui/itemviews/qtreeview.cpp
r651 r769 2475 2475 QVector<QTreeViewItem> insertedItems(delta); 2476 2476 for (int i = 0; i < delta; ++i) { 2477 insertedItems[i].index = d->model->index(i + start, 0, parent); 2478 insertedItems[i].level = childLevel; 2479 insertedItems[i].hasChildren = d->hasVisibleChildren(insertedItems[i].index); 2480 insertedItems[i].hasMoreSiblings = !((i == delta - 1) && (parentRowCount == end +1)); 2477 QTreeViewItem &item = insertedItems[i]; 2478 item.index = d->model->index(i + start, 0, parent); 2479 item.level = childLevel; 2480 item.hasChildren = d->hasVisibleChildren(item.index); 2481 item.hasMoreSiblings = !((i == delta - 1) && (parentRowCount == end +1)); 2481 2482 } 2482 2483 if (d->viewItems.isEmpty()) … … 3770 3771 viewItems[previousSibiling].hasMoreSiblings = false; 3771 3772 3772 3773 updateChildCount(parentItem, -removedCount); 3774 if (parentItem != -1 && viewItems.at(parentItem).total == 0) 3775 viewItems[parentItem].hasChildren = false; //every children have been removed; 3773 if (parentItem != -1) { 3774 if (viewItems.at(parentItem).expanded) { 3775 updateChildCount(parentItem, -removedCount); 3776 if (viewItems.at(parentItem).total == 0) 3777 viewItems[parentItem].hasChildren = false; //every children have been removed; 3778 } else if (viewItems[parentItem].hasChildren && !hasVisibleChildren(parent)) { 3779 viewItems[parentItem].hasChildren = false; 3780 } 3781 } 3776 3782 if (after) { 3777 3783 q->updateGeometries();
Note:
See TracChangeset
for help on using the changeset viewer.