368 {
369
371 return 0;
372 }
373
374
375
377
379
380 const int maxWidth = isVertical ?
rect.width() :
rect.height();
381
382 const int iconWidth = qMax(1, isVertical ?
iconSize.width() :
iconSize.height());
383 const int iconHeight = qMax(1, isVertical ?
iconSize.height() :
iconSize.width());
384
385 const int maxColumns = qMax(1, (maxWidth / iconWidth));
386
389 bool firstSection = true;
393 if (buttonCount == 0) {
394
395 if (notDryRun) {
396 section->setGeometry(1000, 1000, 0, 0);
397 }
398 continue;
399 }
400
401
402 const int neededRowCount = ((buttonCount-1) / maxColumns) + 1;
403
404 if (firstSection) {
405 firstSection = false;
406 } else {
407
409 y += iconHeight + spacing();
410 if (notDryRun){
411 const Section::Separators separator =
414 }
415 }
416
417 if (notDryRun) {
418 const int usedColumns = qMin(buttonCount, maxColumns);
419 int narrowSide = usedColumns * iconWidth;
420 int longSide = neededRowCount * iconHeight;
421 if (isVertical) {
422 int realX;
423 if (parentWidget()->isLeftToRight()) {
425 } else {
426 realX =
rect.width() -
x - narrowSide;
427 }
428 section->setGeometry(realX, y,
429 narrowSide, longSide);
430 } else {
431 int realX;
432 if (parentWidget()->isLeftToRight()) {
434 } else {
435 realX =
rect.width() -
y - longSide;
436 }
437 section->setGeometry(realX, x,
438 longSide, narrowSide);
439 }
440 }
441
442
443 const int lastRowColumnCount = buttonCount - ((neededRowCount-1) * maxColumns);
444 x += (lastRowColumnCount * iconWidth) + spacing();
445
446 y += (neededRowCount - 1) * iconHeight;
447 }
448
449
450 return y + iconHeight;
451 }
int iconSize(qreal width, qreal height)
void setSeparator(Separators separators)
int visibleButtonCount() const