And the king also said, ‘Blessed be the Lord, the God of Israel, who has granted someone to sit on my throne this day, my own eyes seeing it.’
1 Kings 1:48
These are more than the words of a proud father. These are words of praise and worship. David is seeing God powerfully honor His covenant with the king that his heir would sit on the throne in Jerusalem. Solomon has been chosen as David's successor, thus successfully quelling the potential usurper to the throne, Adonijah. Another potential civil war in Israel is avoided through this action.
David lived into old age and saw his son Solomon on the throne. A very rare moment arrived where the still living king was able to appoint his princely son to power. This too was God's gift and definitely not the normal situation of power change in the ancient Near East. God brought peace to David in his final days by this transition, and that is part of the king's praise.
David knew that the kingdom was the Lord's. David knew that Solomon was the best suited heir to continue leading Israel with that understanding. And God led the nation to the best situation as Solomon was crowned king, anointed by God, appointed by David, accepted by God's people.