The main focus of this paper is a method for real-time optimization of the gear shift trajectories for electric vehicles (EVs) with dual clutch transmissions. First, a driveline model was arranged for each gear shift process. The states in each gear shift process can be predicted through these models. An objective function is composed of a frequency-shaped jerk to minimize the shift shock and take into account the bandwidth limit of the lower-level controller. Equality constraints are defined for smooth model changes during the gear shift processes. Moreover, the conditions needed to reflect the driver's pedal input (which can be changed in real-time) is composed of an equality constraint. In addition, inequality constraints are constructed to limit the maximum value of the torque, torque rate, and jerk during gear shift processes. Finally, the problem is formulated in quadratic programming (QP) form. The gear shift trajectories and feedforward inputs are generated by obtaining an optimal solution through the QP solver. The performance of the proposed algorithm is verified through testbench experiments.